toxicious Posted April 20, 2012 Share Posted April 20, 2012 I am using a script for resizing an iframe to fit its content (only the height), but recently when I made some changes to a content page so it gets taller, it refuses to resize that iframe to the right height. Instead it resizes the iframe to about 20 pixels too short. I have no idea why it does that. I have tried in Chrome and IE and there it still works. I have one clue on what it can be: There are like 10 lines of text on that content page, each with <p> tags. It seems that firefox fetches the length of the document, if you measure from the top to the bottom. BUT when it renders the content it renders a padding at the top and the bottom that's about 20px total. It feels like it forgets to take into account that padding when retrieving the height. Am I right? If so, how to solve it?I've tried in both FF Aurora and ordinary FF. EDIT: Oh ######, realized I posted this in the wrong forum, please move to javascript! Also, just to add to the pile of working browsers, even Dreamweaver renders it right! Link to comment Share on other sites More sharing options...
dsonesuk Posted April 21, 2012 Share Posted April 21, 2012 What are you using to retrieve height? offsetHeight or scrollHeight, or you could just add 50 to returned height for content height. Link to comment Share on other sites More sharing options...
toxicious Posted April 21, 2012 Author Share Posted April 21, 2012 What are you using to retrieve height? offsetHeight or scrollHeight, or you could just add 50 to returned height for content height. The scrollheight (as can be seen in the topic title ), I tried with offsetheight but it said exactly the same value. Well yeah I could probably solve it that way, but it feels like stitching two wooden planks together instead of using one that is the wanted length I would have solved it that way if all browser would have been wrong, but since Chrome renders it perfectly, and IE renders it OK I want to know if there are another solution or if this is a bug in Firefox. Link to comment Share on other sites More sharing options...
dsonesuk Posted April 21, 2012 Share Posted April 21, 2012 From what i remember FF, Opera use contentDocument.documentElement.scrollHeight; to retrieve height, and IE used F.contentWindow.document.body.scrollHeight; and I think Chrome could use either method. Link to comment Share on other sites More sharing options...
toxicious Posted April 22, 2012 Author Share Posted April 22, 2012 From what i remember FF, Opera use contentDocument.documentElement.scrollHeight; to retrieve height, and IE used F.contentWindow.document.body.scrollHeight; and I think Chrome could use either method. You remember right, that solved it! Thx Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.