Log in

View Full Version : Dynamic Scrolling to fit in side iframe



Gary4u
09-08-2018, 04:11 PM
Hi,

Dynamic Scrolling to fit in side iframe. Looking for a script to adjust the running scrolling - IFRAME Scroller script.

The scrolling full script which should be displaying is not showing but only half of the script matter.

eg:
The scrolling full script which should be .this is end <..this is shown but this is not shown >---[ displaying is not showing but only half of the script matter.]

But if you turn to landscape it shows full but portrait it does not show.


Please do let me know any one can help me out.



THanks
Gary

amzoun95
03-04-2019, 10:17 PM
You can do this with JavaScript or JQuery. Here are a couple references...

http://stackoverflow.com/questions/819416/adjust-width-height-of-iframe-to-fit-with-content-in-it

http://www.codeproject.com/Articles/19499/How-To-Adjust-IFrame-Height-on-Its-Content

amzoun95
03-04-2019, 10:18 PM
For removing scrollbars from the iFrame the simplest I could think is CSS as:


iframe {
overflow: hidden;
}
And for making the content fit automatically use:

Add this to your <head> section

<script language="javascript" type="text/javascript">
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}
</script>
And change your iframe to this:


<iframe name="Stack" src="http://stackoverflow.com/" frameborder="0" scrolling="no" id="iframe" onload='javascript

james438
03-06-2019, 05:49 AM
Mod Note: User amzoun95 has been banned. It appears he was involved in some hiding some malicious links in his post. We do try to ban all spammers when they appear, however this time the user came back and edited his post to include at least one link to a malware site. We want DynamicDrive to be a safe place for coders to ask questions and find answers and encourage any questionable posts to be reported.

James438