mouse scrolling wheel not working when the cursor is on the iFrame

走远了吗. 提交于 2019-12-24 02:23:40

问题


Here is my Html:

<iframe onload="reloadOnce(this)" frameborder="no" src="cloud.php" class="foo1" scrolling="no" seamless="seamless" allowTransparency="true" width="100%" height="90em"></iframe>

and Here is my CSS

.foo1{margin: 0; padding: 0; width:100%; height:90em; overflow-x: scroll; }

As I know, overflow-x: scroll; is not necessary, even I removed it, but still It's same. I'm using this for parallax web scrolling. For your information, I tried to use z-index: function, but not effected!

Actually mouse scrolling is working in other web areas but not in iFrame specific area.

Thanks in Advance.


回答1:


You can just position a transparent div over it. I shaded it green a little so you can see it. If you remove the .iframeHat, the iframe is scrollable.

Hopefully this works for you, as long as you don't have any content within the iframe you intend users to interact with.

HTML:

<div id="content1"></div>
<iframe id="iframe" src="http://fender.com"></iframe>
<div class="iframeHat"></div>
<div id="content2"></div>

CSS:

#iframe, .iframeHat {
width:300px;
height:300px;
margin-left:50px;
border:none;
}
.iframeHat {
margin-top:-304px;
background-color:rgba(10,100,0,0.5);
position:relative;
z-index:999;
}

http://jsfiddle.net/u940x50x/



来源:https://stackoverflow.com/questions/26090595/mouse-scrolling-wheel-not-working-when-the-cursor-is-on-the-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!