Quiter 99 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 Čaute. Potreboval by som pomoc s dynamickým iframe. Potrebujem aby sa jeho veľkosť upravovala podla obsahu. Na nete som si našiel script, ktorý mi v škole funguje ale doma nie, neviete niekto prečo a čo s tým ? <iframe id="myFrame" src=""></iframe> <script type="text/javascript"> var f = document.getElementById("myFrame"); f.onload = function() { this.height = this.contentWindow.document.body.offsetHeight; } </script> Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 máš height a width je kde? Link to comment Share on other sites More sharing options...
0 Quiter 99 Odesláno: 3. Prosinec, 2013 Author Share Odesláno: 3. Prosinec, 2013 máš height a width je kde? načo width ? width nastavím v css Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 ale potrebuješ zistiť pre frame čo ak tam niečo bude väčšie? potom to už no .. ešte som si všimol src, nastavuješ nejakú cestu? Link to comment Share on other sites More sharing options...
0 Quiter 99 Odesláno: 3. Prosinec, 2013 Author Share Odesláno: 3. Prosinec, 2013 no nebude tam nič vačšie, proste width chcem mať stále rovnaký... len height potrebujem dynamický ano cestu nastavujem... mňa by skôr zaujímalo, prečo mi to v škole fungovalo a doma už nie... Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 (upraveno) <script type="text/javascript"> var f = document.getElementById("myFrame"); f.height = f.contentWindow.document.body.offsetHeight; </script> takto si to myslel? Edited 3. Prosinec, 2013 by MasterMatoSK Link to comment Share on other sites More sharing options...
0 Quiter 99 Odesláno: 3. Prosinec, 2013 Author Share Odesláno: 3. Prosinec, 2013 <script type="text/javascript"> var f = document.getElementById("myFrame"); f.height = f.contentWindow.document.body.offsetHeight; </script> takto si to myslel? Ani toto mi nefunguje... ten iframe je stále rovnaký... Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 f.style.height = f.contentWindow.document.body.scrollHeight + “px”; ešte otázka, na akom internetovom prehliadači to testuješ? Link to comment Share on other sites More sharing options...
0 steel 71 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 Smazáno uživatelem. Link to comment Share on other sites More sharing options...
0 Quiter 99 Odesláno: 3. Prosinec, 2013 Author Share Odesláno: 3. Prosinec, 2013 f.style.height = f.contentWindow.document.body.scrollHeight + “px”; ešte otázka, na akom internetovom prehliadači to testuješ? chrome Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 <script type="text/javascript"> var f = document.getElementById("myFrame"); f.style.height = f.contentWindow.document.body.offsetHeight + 'px'; </script> toto musí fungovať, lebo ak nie, už neviem Link to comment Share on other sites More sharing options...
0 Quiter 99 Odesláno: 3. Prosinec, 2013 Author Share Odesláno: 3. Prosinec, 2013 <html> <head> <title>Quiter</title> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <div class="top"></div> <div class="cont"> <div id="header">Quiter</div> </div> <div class="bottom"></div> <iframe id="myFrame" src="page/news.html"></iframe> <script type="text/javascript"> var f = document.getElementById("myFrame"); f.onload = function() { this.height = this.contentWindow.document.body.offsetHeight; } </script> </body> </html> Takto mám celé HTML a nefunguje to... Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 <script type="text/javascript"> var f = document.getElementById("myFrame"); f.style.height = f.contentWindow.document.body.offsetHeight + 'px'; </script> no ale toto použi Link to comment Share on other sites More sharing options...
0 Quiter 99 Odesláno: 3. Prosinec, 2013 Author Share Odesláno: 3. Prosinec, 2013 stále nič... Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 tak sa na to vyserieme a použijeme jquery $("iframe").load(function() { f.style.height = f.contentWindow.document.body.offsetHeight + 'px'; }); tu netreba žiadny class alebo do id dávať, je to globálne, no proste pre iframe ešte jedno, iframe sa neukončuje </iframe> ale hneď ako to spúštaš: <iframe src="page/news.php" /> Link to comment Share on other sites More sharing options...
0 Quiter 99 Odesláno: 3. Prosinec, 2013 Author Share Odesláno: 3. Prosinec, 2013 Škoda. Ako použiť to jquery ? V oblasti web stránok som zatial len u CSS (ten javascript je z netu skopírovaný). A iframe sa ukončuje </iframe>, pretože keď som to dal preč, tak mi nezobrazovalo odkazy pod ním... Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 potom ako končiš <iframe> tak musíš pred > dať / (takže <iframe /> ) nikdy som nepočul žeby sa to ukončovalo ako </iframe> lebo mi to nepasuje, to nie je ako <p> že odstavec </p> jquery sa naučíš aj základy na stránke w3schools.com Link to comment Share on other sites More sharing options...
0 Quiter 99 Odesláno: 3. Prosinec, 2013 Author Share Odesláno: 3. Prosinec, 2013 potom ako končiš <iframe> tak musíš pred > dať / (takže <iframe /> ) nikdy som nepočul žeby sa to ukončovalo ako </iframe> lebo mi to nepasuje, to nie je ako <p> že odstavec </p> jquery sa naučíš aj základy na stránke w3schools.com no keď dám <iframe src...></iframe>A sem nejaky text, tak sa mi ten text zobrazí. keď dám <iframe src... />Nejaky text, tak sa ten text nezobrazí... pozrem na tú stránku, dík Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 3. Prosinec, 2013 Share Odesláno: 3. Prosinec, 2013 no keď dám <iframe src...></iframe>A sem nejaky text, tak sa mi ten text zobrazí. keď dám <iframe src... />Nejaky text, tak sa ten text nezobrazí... pozrem na tú stránku, dík ak by si ešte niečo potreboval, napíš SZ Link to comment Share on other sites More sharing options...
Dotaz
Quiter 99
Čaute.
Potreboval by som pomoc s dynamickým iframe.
Potrebujem aby sa jeho veľkosť upravovala podla obsahu.
Na nete som si našiel script, ktorý mi v škole funguje ale doma nie, neviete niekto prečo a čo s tým ?
Link to comment
Share on other sites
18 odpovědí na tuto otázku
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now