为了账号安全,请及时绑定邮箱和手机立即绑定

jq scroll绑定问题

jq scroll绑定问题

开满天机 2018-10-10 14:11:15
$(window).scroll(function(){    var documentTop = $(document).scrollTop();    var windowHeight = $(window).height();    var documentHeight = $(document).height();    //var txt = "windowHeight:"+windowHeight + " |*$*| documentTop:"+documentTop + " |*$*| documentHeight:"+documentHeight;    //当 documentTop >= (documentHeight-windowHeight) 说明滚动条已经滚动到底部了    if(documentTop >= (documentHeight-windowHeight)){    console.log("加载");        var tableTxt = $("#table").html();        $("#txt").append("<hr>" + tableTxt);    }    })今天用这段代码在自己电脑上面和工作机上面运行都没问题,scroll生效,但是放到项目里面没法生效,debug js代码的时候,发现进不去$(window).scroll(function(){这个函数。有哪位大神遇到过这种问题,了解里面的机制的求解答一下,多谢。
查看完整描述

1 回答

?
慕尼黑的夜晚无繁华

TA贡献1864条经验 获得超6个赞

我建议尝试一下 $(document).scroll()


查看完整回答
反对 回复 2018-11-04
  • 1 回答
  • 0 关注
  • 807 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号