[英]Web - How to not disable but hide the scroll in an iframe?
My website is available here . 我的网站可以在这里找到 。
Problem is that I'm getting a double scroll because I used an iframe
to display content in each page of my website. 问题是我得到了两次滚动,因为我使用iframe
在网站的每个页面中显示内容。
I tried this: 我尝试了这个:
<iframe ... scrollable="no"></iframe>
and also tried to override the default css by using !important: 并且还尝试使用!important覆盖默认的CSS:
.fancybox-overlay, .fancybox-overlay-fixed {
overflow: hidden !important;
}
But nothing is working. 但是没有任何效果。
How to fix that? 如何解决?
How about making your parent element fit the page so that the only scrollbar is the one inside the iFrame
and not the other way? 如何使您的父元素适合页面,以使唯一的滚动条是iFrame
滚动条,而不是相反的滚动条?
You can do something like this: 您可以执行以下操作:
.fit { position: absolute; top: 0; bottom: 0; left: 0; right: 0 } .Parent { border: 2px solid red } iframe { border: 2px solid green; height: 100%; width: 100%; display: block } * { box-sizing: border-box }
<body> <div class='Parent fit'> <iframe class='fit' src='http://stackoverflow.com'></iframe> </div> </body>
You need to use the scrolling attribute not scrallable . 您需要使用not scrallable的scrolling属性。
source https://www.w3schools.com/tags/att_iframe_scrolling.asp 来源https://www.w3schools.com/tags/att_iframe_scrolling.asp
Try this 尝试这个
<iframe src="https://bing.com"
class="this"
scrolling="no" >
</iframe>
.this { width: 200px; height: 200px; overflow-y: hidden; }
<iframe src="http://bing.com" class="this" scrolling="no" > </iframe>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.