var Height=document.body.clientHeight;$(document).bind("mousewheel DOMMouseScroll scroll", function (e) {??????? if ($(window).scrollTop()==Height) {??????????? alert(1);??????? } });為什么alert(1)不執(zhí)行,改成if ($(window).scrollTop()>=Height) {??????????? alert(1);?}時(shí)才執(zhí)行??墒俏抑幌胱宎lert(1)執(zhí)行一次
3 回答
已采納

stone310
TA貢獻(xiàn)361條經(jīng)驗(yàn) 獲得超191個(gè)贊
滾屏速度太快了,可以設(shè)定個(gè)區(qū)域,加個(gè)判斷條件 或者自己看還有沒有更好的辦法,匆忙間暫時(shí)就這個(gè)
var?flag=true; var?Height=document.documentElement.clientHeight||document.body.clientHeight; $(document).bind("mousewheel?DOMMouseScroll?scroll",?function?(e)?{ ????console.log($(window).scrollTop()) ????console.log(Height) ????if?($(window).scrollTop()>Height-50?&&?$(window).scrollTop()<Height+50?&&?flag==true)?{ ????????alert(1); ?????????flag=false; ????} });
- 3 回答
- 0 關(guān)注
- 1373 瀏覽
添加回答
舉報(bào)
0/150
提交
取消