简体   繁体   中英

Is there a way to prevent double scrolling bars using iframe

This question appears to be a duplicate that was unanswered or similar to HTML iframe - Double Scrolling Bars .

I would like to know how to remove the scrolling bar of the iframe and use the browser's scrolling bar to navigate the page up and down?

 <html> <body style="margin: 0; padding: 0; border: 0; outline: 0;"> <div style="width:100%;height:50px; background-color:red;"></div> <iframe frameBorder="0" style="width:100%;height:100%;" src="http://www.mynewplace.com/apartments-for-rent/st-paul-mn"></iframe> </body> </html>

在此处输入图片说明

You can try scrolling="no" for iframe

iframe { overflow:hidden;}

HTML:

<iframe frameBorder="0" style="width:100%;height:100%;" scrolling="no" src="http://www.mynewplace.com/apartments-for-rent/st-paul-mn"> 
  </iframe>

Try to set up height of all parent element to 100% (so HTML and BODY tag) and then put height of iframe to calc(100% - 50px)

 html, body{height: 100%;}
 <html> <body style="margin: 0; padding: 0; border: 0; outline: 0;"> <div style="width:100%;height:50px; background-color:red;"></div> <iframe frameBorder="0" style="width:100%;height:calc(100% - 50px);" src="http://www.mynewplace.com/apartments-for-rent/st-paul-mn"> </iframe> </body> </html>

try to set height by jvascript, example:

<iframe id="test" FRAMEBORDER=0
  src="form.jsp"
  style="width: 100%"
  onload="this.height=document.body.scrollHeight">
</iframe>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM