如何只在 iFrame 内滚动,而不是整个窗口?我想在 iFrame 下方放置文本,但当文本比 iFrame 长时它会显示出来。你可以去 www.thesocialscreensaver.com 看看我在说什么。谢谢!
最佳答案
您可以在 div 中使用 iframe,如下所示:
<div id="iframeINSIDE" style="width: 600px; height: 200px; overflow: hidden;">
<iframe name="abc" style="width: 620px; height: 200px;" src="File.html"></iframe>
我已经在 Firefox 和 IE 上检查过了,它们都可以正常工作。您可以使用鼠标滚轮滚动,也可以通过将鼠标指针拖动到 div 上进行滚动。这只会滚动 iframe 而不是整个窗口。
检查它是否适合您。
新增: http://jsfiddle.net/TJZT4/10/
要使 iframe 成为网页的 100%,请使用:
<body>
<iframe src="http://jsfiddle.net/" style="height:100%;width:100%" height="100%" width="100%" frameborder="0" ></iframe>
</body>
关于css - 如何只滚动 iFrame 而不是整个窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14722142/