监听浏览器滚动

<html>

<body>

  <div style="height:0px;width:400px;background:rgba(88,116,178,0.6);overflow:hidden;" class="div3"></div>

</body>

</html>

<script>
window.onscroll=function(){
var scrollTop=document.body.scrollTop;
if(scrollTop>=100){
$('.div3').animate({
height:'200px'
},2000)
}
}

</script>

posted @ 2017-02-16 15:25  yewook  阅读(549)  评论(0)    收藏  举报