标签:set client document 距离 get element pre off doc
1 window.onscroll=function () { 2 var sTop=document.body.scrollTop; 3 var WH=document.body.clientHeight; 4 var con=document.getElementById(‘con‘); 5 var dTop=con.offsetTop; 6 7 if (sTop>=dTop-(WH-100)) { 8 //执行动画 9 }; 10 }
标签:set client document 距离 get element pre off doc
原文地址:http://www.cnblogs.com/wlingling2017/p/6376178.html