<iframe width="608" frameborder="0" id="mainframe" name="mainframe" onload="$(this).height($(this).contents().height());" src="mindex/forratt.php" scrolling="no" /></iframe>

So I have written this code to automatically adjust the iframe to its content and it works fine.

The thing is that when I access a page with a lower height, the height from the previous page stays put. I want it to automatically adjust to the height of the new page.

How do I make that happen? Give me some pointers please! <3

Recommended Answers

All 2 Replies

are you calling the new page from within the iframe ?

If no, make it a click function to run the $(this).height($(this).contents().height()); maybe? Instead of the onload to call it everytime to event is called to the iframe?

Thank you, problem solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.