第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

想讓某個(gè)函數(shù)執(zhí)行一次

想讓某個(gè)函數(shù)執(zhí)行一次

艷妮子Yeah 2016-11-01 15:08:21
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;
????}
});


查看完整回答
1 反對(duì) 回復(fù) 2016-11-01
?
李曉健

TA貢獻(xiàn)1036條經(jīng)驗(yàn) 獲得超461個(gè)贊

Height 哪來的?

查看完整回答
反對(duì) 回復(fù) 2016-11-01
  • 艷妮子Yeah
    艷妮子Yeah
    var Height=document.body.clientHeight;
  • 李曉健
    李曉健
    因?yàn)闉g覽器滾動(dòng)時(shí),并不一定是一個(gè)像素一個(gè)像素的滾動(dòng)的,所以用等于就可能不會(huì)成立。
  • 3 回答
  • 0 關(guān)注
  • 1373 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)