User
Pass
2FA
 
 

Iframes problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database
Author Message2211
PpSi

[Mentally Stable]



Status: Offline
(since 23-09-2012 21:04)
Joined: 07 Sep 2011
Posts: 50, Topics: 6
Location: Sillicon Valley

Reputation: 54
Votes: 3

Post Posted: 07-09-2011, 17:08:44 | Translate post to: ... (Click for more languages)

Salut!

In ultima vreme lucrez la un site in interes personal si am dat peste o problema.

Pagina principala(indexul) contine doar navbarul, continul paginii fiind inclus intr-un iframe de 1000 pe 1000.

Problema e ca in anumite pagini am mai mult continut decat in celelalte(sau pe parcurs se va strange mai mult continut)--> pagina cu height > 1000.Ideea e ca nici nu vreau sa imi apara un scrollbar in iframe.

Am cautat putin si am gasit niste tutoriale(mai vechi, ce-i drept) care arata cum sa faci iframeul sa isi modifice inaltimea in functie de pagina ce urmeaza sa fie incarcatata, dar cand le-am pus in aplicare nu au facut ce am vrut eu sa faca.

asta si asta sunt 2 din cate am incercat.In legatura cu restul am avut si eu niste dubii asa ca nu m-am mirat cand nu au mers, deci nu are rost sa le postez.

Daca stie cineva un script care sa ma ajute, sau stie cum pot sa fac iframeul sa isi schimbe inaltimea in functie de paginea ce urmeaza sa fie incarcata, please healpf >.<

ty


We are gamers.The only thing we hate more than stagnation is change.
0 0
  
Back to top
View user's profile Send private message
PpSi

[Mentally Stable]



Status: Offline
(since 23-09-2012 21:04)
Joined: 07 Sep 2011
Posts: 50, Topics: 6
Location: Sillicon Valley

Reputation: 54
Votes: 3

Post Posted: 10-09-2011, 00:27:43 | Translate post to: ... (Click for more languages)

BUMP!

anywone? Sigh


We are gamers.The only thing we hate more than stagnation is change.
0 0
  
Back to top
View user's profile Send private message
Tr3z3gu3T

[Mentally Stable]



Status: Offline
(since 12-06-2019 13:16)
Joined: 29 Sep 2006
Posts: 493, Topics: 71
Location: Romania

Reputation: 481.6
Votes: 14

 
Post Posted: 10-09-2011, 02:56:26 | Translate post to: ... (Click for more languages)

vezi ca nu cumva sa depinda de browser... posibil sa nu functioneze in toate...
0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
PpSi

[Mentally Stable]



Status: Offline
(since 23-09-2012 21:04)
Joined: 07 Sep 2011
Posts: 50, Topics: 6
Location: Sillicon Valley

Reputation: 54
Votes: 3

Post Posted: 10-09-2011, 12:02:12 | Translate post to: ... (Click for more languages)

am vazut ca fiecare browser interpreteaza diferit variantele de mai sus, nevertheless, in nici unul nu mergeau.

in chrome nu se intampla absolut nimic.In firefox, opera si safari iframeul isi modifica heightul la aproximativ 250-300px si aparea un scrollbar in lateral, chiar daca daca avea scrolling="no" -.-


We are gamers.The only thing we hate more than stagnation is change.
0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 10-09-2011, 13:29:47 | Translate post to: ... (Click for more languages)

În primul rând, cele 3 fișiere trebuie sã fie pe același domeniu.

main.html
Code:
<style> * { margin: 0px; padding: 0px; } </style>
<a href="frame1.html" target="myIframe">Frame 1</a> | <a href="frame2.html" target="myIframe">Frame 2</a>
<iframe id="frm" name="myIframe" src="" style="height: 200px; width: 100%; border: 1px solid #F00;"></iframe>
<script language="javascript">
var ifrm = document.getElementById('frm');
ifrm.onload = function() {
   ifrm.style.height = '1px';
   ifrm.style.height = myIframe.document.body.scrollHeight + 'px';
};
</script>

frame1.html
Code:
<style> * { margin: 0px; padding: 0px; } </style>
<div style="height: 1000px; width: 500px; border: 1px solid #000000;"></div>

frame2.html
Code:
<style> * { margin: 0px; padding: 0px; } </style>
<div style="height: 200px; width: 500px; border: 1px solid #000000;"></div>


Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
Tr3z3gu3T

[Mentally Stable]



Status: Offline
(since 12-06-2019 13:16)
Joined: 29 Sep 2006
Posts: 493, Topics: 71
Location: Romania

Reputation: 481.6
Votes: 14

 
Post Posted: 10-09-2011, 20:05:55 | Translate post to: ... (Click for more languages)

incearca si css@ overflow:
0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 10-09-2011, 20:45:11 | Translate post to: ... (Click for more languages)

Nu merge cu overflow.

Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
PpSi

[Mentally Stable]



Status: Offline
(since 23-09-2012 21:04)
Joined: 07 Sep 2011
Posts: 50, Topics: 6
Location: Sillicon Valley

Reputation: 54
Votes: 3

Post Posted: 13-09-2011, 12:16:34 | Translate post to: ... (Click for more languages)

Scuze de raspunsul intarziat, am fost putin plecat zilele acestea! Mersi de raspuns!
Daaaar, poate am gresit eu ceva, insa nu merge:<
Am pus asta in head:

Code:
<script language="javascript">
var ifrm = document.getElementById('frm');
ifrm.onload = function() {
   ifrm.style.height = '1px';
   ifrm.style.height = myIframe.document.body.scrollHeight + 'px';
};
</script>


asta am in css la iframe
Code:
#ifrm
{
width:1000px;
height:200px;
position:relative;
margin-top:5px;
margin-left:17px;
}


iar iframeul e declarat asa:
Code:
<iframe id="ifrm" name="ifrm" src="home.htm" frameborder="0" scrolling="0" >


Cand am incercat am schimbat la name din "ifrm" in "myiframe"(sa fie ca in exemplu dat de tine) si nimic.In javascript, la var ifrm = document.getElementById('frm'); , chiar la sfarsit nu trebuia idul/numele cu care am declarat eu iframeul?sau asa e scriptul?Ma refer la ('ifrm').Am incercat si acolo diferite variante dar tot nimic:<

De asemenea, am mai schimbat si linia asta: ifrm.style.height = myIframe.document.body.scrollHeight + 'px'; cand am vazut ca nu merge, din myIframe-->ifrm

in jur la pagina am un div "wrapper", care centreaza pagina, are vreo legatura cu problema mea?

Code:
 .wrapper {
margin: 0 auto;
margin-top:-12px;
text-align:left;
width:1002px;
}
there's the css.

Also, cand ma joc cu iframeul, mai pun frameborder 1, ca sa vad cum stau.Momentan scriptul, in materie de height, nu face nimic.Heightul ramane la 200px, dar imi apare un scrollbar vertical, chiar daca atunci cand am declarat frameul am setat scrolling="0".

LE:exista vreo sansa ca iframeul sa nu "creasca" pentru ca nu "ar mai avea unde"?Momentan nu i-am dat paginii per ansamblu o inaltime fixa.Cat de mare e iframeul, atat e pagina(bine, headerul e tot acolo).


We are gamers.The only thing we hate more than stagnation is change.
0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 13-09-2011, 16:33:21 | Translate post to: ... (Click for more languages)

Dacã salvezi fișierele exact așa cum ți le-am dat eu și intri în main.html, o sã meargã bine. Fișierele trebuie puse pe un host cu același domeniu, mie nu îmi merge dacã le rulez de pe desktop (local file).

Problema la tine este cã ai pus javascript-ul în header. Eu îl pusesem dupã iframe. Adicã, întâi declarã iframe-ul, apoi îl acceseazã din JS. Dacã vrei sã îl pui în header, trebuie sã execute JS-ul doar dupã ce s-a încãrcat pagina, adicã la window.onload.

Încã o problemã, eu l-am testat doar în chrome, dar ar trebui sã meargã și în IE / FF.

LE: Le-am testat și în IE / FF, works like a charm. Take a look.


Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
PpSi

[Mentally Stable]



Status: Offline
(since 23-09-2012 21:04)
Joined: 07 Sep 2011
Posts: 50, Topics: 6
Location: Sillicon Valley

Reputation: 54
Votes: 3

Post Posted: 13-09-2011, 22:21:21 | Translate post to: ... (Click for more languages)

mersi din nou, am sa incerc din nou, insa momentan sunt prins cu lucrul la anumite parti de continut(partea de coding a mers mult mai rapid :<)

am sa revin cu un edit daca am reusit sau nu, mersi din nou!

P.S. Ti-as da +rep daca as putea, chit ca n-am mult, insa momentan nu am 1 sapt de la inregistrare -


We are gamers.The only thing we hate more than stagnation is change.
0 0
  
Back to top
View user's profile Send private message
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database  


The time now is 01-12-2024, 22:45:20
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x