js监听横向滚动条事件
<scripttype="text/javascript">varfixedDom=document.getElementById('fixed');document.a...
<script type="text/javascript">
var fixedDom = document.getElementById('fixed');
document.addEventListener('scroll',winScroll,false);
function winScroll(e){
debugger
if(fixedDom.offsetLeft < document.body.scrollLeft){
};
if(fixedDom.offsetLeft > document.body.scrollLeft){
};
}
</script> 展开
var fixedDom = document.getElementById('fixed');
document.addEventListener('scroll',winScroll,false);
function winScroll(e){
debugger
if(fixedDom.offsetLeft < document.body.scrollLeft){
};
if(fixedDom.offsetLeft > document.body.scrollLeft){
};
}
</script> 展开
1个回答
展开全部
你要监听的对象错误了。你要监听的是fixedDom
var fixedDom = document.getElementById('fixed');
fixedDom.addEventListener('scroll',winScroll,false);
function winScroll(e){
debugger
if(fixedDom.offsetLeft < document.body.scrollLeft){
};
if(fixedDom.offsetLeft > document.body.scrollLeft){
};
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询