var Height=document.body.clientHeight;$(document).bind("mousewheel DOMMouseScroll scroll", function (e) {??????? if ($(window).scrollTop()==Height) {??????????? alert(1);??????? } });為什么alert(1)不執行,改成if ($(window).scrollTop()>=Height) {??????????? alert(1);?}時才執行。可是我只想讓alert(1)執行一次
3 回答
已采納

stone310
TA貢獻361條經驗 獲得超191個贊
滾屏速度太快了,可以設定個區域,加個判斷條件 或者自己看還有沒有更好的辦法,匆忙間暫時就這個
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 關注
- 1388 瀏覽
添加回答
舉報
0/150
提交
取消