onscroll无法与IE一起使用 [英] onscroll won't work with IE
本文介绍了onscroll无法与IE一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有onScroll="Scroll()"
的身体".滚动方法应该在用户滚动页面时滚动一些div.
i have a "body" with onScroll="Scroll()"
. Scroll method should, well, scroll some div as user scrolls the page.
Scroll():
function Scroll()
{
var el = document.getElementById('controlBox');
var ScrollTop = document.body.scrollTop;
el.style.top = ScrollTop + "px";
}
它与Chrome和FF兼容,但IE无法配合.怎么了?
It works fine with Chrome and FF, but IE won't cooperate. What's wrong here?
推荐答案
从您的body标签中删除onScroll,然后尝试添加
Remove the onScroll from your body tag, and try adding
window.onscroll = Scroll;
功能之外的JavaScript.
to your javascript, outside of the function.
这篇关于onscroll无法与IE一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文