milov.nl

Interaction design • webdevelopment • web art • photography

milov.nl : forum : coding : 'iframe + overflow-y'

iframe + overflow-y borline, 030627 06:10
what i want to do is have several (26 to be exact, one for each letter of the alphabet) iframes stacked on top of each other, and the src for each of these iframes is coming from a page that is dynamically generated, so i never know how large it is going to be. is there a way i can have the iframe resize to the size of the content of the src page, so there are no scrollbars and it looks like its within the main page itself?
cache-2.lnh.md.webcache.rcn.net
Re: iframe + overflow-y borline, 030627 06:15
like i said the src's are dynamically generated and i want the iframes to be dynamically sized according to the content on the src's, k!
cache-2.lnh.md.webcache.rcn.net
Re: iframe + overflow-y colin, 030702 11:11
Hmm... not 100% sure without trying this, but:

In each iframe, have a line at the end of the generated content like:
<script DEFER>parent.resizeMe(self.name,document.body.scrollWidth,document.body.scrollHeight)</script>
 

and make sure the body tag looks like:
<body style="margin:0;border:0;" scroll="no">
 

and in the parent frame you have:
<script>
function resizeMe(sFrame,iX,iY) {
obj = document.all[sFrame].style;
obj.width = iX;
obj.height = iY;
}
</script>
 

...and the iframe:
<iframe src="myFrame.php" name="myName"></iframe>
 

Yup, just tried it, and the iframe automagically resizes once the contents have been rendered! Um, probbably wont work in NS or pre 4.0 browsers, although it might just.

HTH...
Colin
proteus.highway.co.uk
Re: iframe + overflow-y Morten, 030928 14:01
You don't know how thankfull i am for that answer! I've been looking all over for this answer! It works just fine! :D
Thanks, thanks, thanks!
0x50a40624.banxx1.adsl-dhcp.tele.dk
Re: iframe + overflow-y yahoo.com,kplaskett,Keith, 031002 23:18
What about if you only control the header and footer of the content within the frame?

I've been trying this script as you mentioned and can't get it to work for the life of me!

It just creates a small frame without scrollbars.
12-239-247-41.client.attbi.com
Re: iframe + overflow-y hotmail.com,devendrasinghrawat,Devendra, 031020 08:29
Hi Colin,

I saw this problem and your reply.. It waorks perfectly for me too.. But, there is some problem in some frames, i.e , Some of the frames get resized and some do not, can you guess the reason y. It happens sometimes and not always..
203.122.33.2
Re: iframe + overflow-y Albert, 050215 20:21
Colin, thank you very much for your solution! It looks like it will work out great. I'm using this in conjunction with the idea presented here http://www.codetoad.com/forum/20_22736.asp for iframe dropdown menus on top of "select option" drop down menus.
204.225.80.19
Re: iframe + overflow-y superonline.com,lonynamer,Leony, 050222 06:33
Hello Dear Friend Colin,

If you correspond, I will be very happy. The code you told works good but there is a ploblem, when the document overflows, it resizes the inlineframe but after that if I open a small document which doesn't overflow, it doesn't resizes the inlineframe, the inline frame stays big, and the document small inside it. I don't know javascirpt well, but the best code about this subject is yours, would you please find me a solution through your code ? If you help me, I wil thank you very very very much ?

blackhole.superonline.com
Pages: 1