jQuery Waypoint无法正常工作 [英] jquery waypoint is not working
本文介绍了jQuery Waypoint无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据下面编写的代码,我认为当我滚动到.onscrollActivate div警报时,应该会出现.但这并没有给我警报.
As per my code written below I think when I scroll to the .onscrollActivate div alert should come. But it is not giving me the alert.
<div class="waypoint" style="width:100%;height:300px;"></div>
$(document).ready(function(){
$('.onscrollActivate').waypoint(function() {
alert();
});
});
如果我改用.click()
,它会给我警报消息.所以我的jquery很好.
If I try .click()
instead, it gives me the alert message.so my jquery is fine.
那么,我要去哪里错了?
So, where am I going wrong?
推荐答案
您看到console
中的waypoint is not a function
错误,表明您尚未在页面上加载waypoint
库.
As you see waypoint is not a function
error in console
, you haven't loaded the waypoint
library on your page.
在jQuery
之后的页面上包含waypoint
js.
Include waypoint
js on the page after jQuery
.
<script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.5/waypoints.min.js"></script>
这篇关于jQuery Waypoint无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文