根据我在下面编写的代码,我想当我滚动到.onscrollActivate div警报应该来了.但它没有给我警报.
<div class="waypoint" style="width:100%;height:300px;"></div>
$(document).ready(function(){
$('.onscrollActivate').waypoint(function() {
alert();
});
});
Run Code Online (Sandbox Code Playgroud)
如果我尝试.click(),它会给我警报信息.所以我的jquery很好.
那么,我哪里错了?
Tus*_*har 16
当您看到waypoint is not a function错误时console,您尚未waypoint在页面上加载库.
waypoint之后在页面上包含js jQuery.
<script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.5/waypoints.min.js"></script>
Run Code Online (Sandbox Code Playgroud)