[英]Hide scrollbar in iframe, while still scrolling
Is there a way to hide a vertical scrollbar in an iFrame, but with still enabling scrolling?有没有办法在 iFrame 中隐藏垂直滚动条,但仍然启用滚动?
Only thing that hides the scrollbars in HTML5 for me is setting scrolling="no", but this locks the scrolls.对我来说,在 HTML5 中隐藏滚动条的唯一方法是设置 scrolling="no",但这会锁定滚动条。 All i want to do is hide them.
我想做的就是隐藏它们。
<iframe width="100%" scrolling="no" src=""></iframe>
scrolling="no"
and和
display:none
Will stop the iFrame from scrolling.将停止 iFrame 滚动。 The only other solution is to "hide" the scrollbar via overlapping.
唯一的其他解决方案是通过重叠“隐藏”滚动条。
<div style="width: 400px; overflow: hidden">
<iframe src="https://fr.wikipedia.org/wiki/Main_Page" width="407"height="480">
</div>
Note the 7 pixel difference between the parent div and the iframe, this effectively cuts off a portion of the iframe so that the scrollbar is hidden but you are still able to scroll.请注意父 div 和 iframe 之间的 7 像素差异,这有效地切断了 iframe 的一部分,因此滚动条被隐藏但您仍然可以滚动。
You can achieve this by putting this in your css file: iframe { overflow:hidden; }
您可以通过将其放入 css 文件中来实现此目的:
iframe { overflow:hidden; }
iframe { overflow:hidden; }
Try this, it will work试试这个,它会工作
<div style='width: 500px; height: 120px; overflow: hidden;'>
<iframe style='width: 518px; height: 120px;' src=''></iframe>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.