Jquery 航路点函数未定义
我只是从我想要创建的站点中的航路点开始 出于测试目的,我创建了一个带有4个彩色div的页面。我想测试当我滚动到第二个div时,航路点是否触发功能 但是,控制台发出错误:Jquery 航路点函数未定义,jquery,jquery-waypoints,Jquery,Jquery Waypoints,我只是从我想要创建的站点中的航路点开始 出于测试目的,我创建了一个带有4个彩色div的页面。我想测试当我滚动到第二个div时,航路点是否触发功能 但是,控制台发出错误:Uncaught ReferenceError:未定义航路点 HTML: JQUERY/航路点: var waypoint = new Waypoint({ element: document.getElementById('#two'), handler: function(direction) { alert(
Uncaught ReferenceError:未定义航路点
HTML:
JQUERY/航路点:
var waypoint = new Waypoint({
element: document.getElementById('#two'),
handler: function(direction) {
alert('I am 20px from the top of the window');
},
});
这是一个很好的例子。您需要Waypoints 2.0.4版,但使用它的方式只能与Waypoints 3.0+一起使用。升级至最新版本
#one{
background-color:red;
// width:100%;
height:400px;
}
#two{
background-color:blue;
float:clear;
height:400px;
}
#three{
background-color:green;
height:400px;
}
#four{
background-color:yellow;
height:400px;
}
var waypoint = new Waypoint({
element: document.getElementById('#two'),
handler: function(direction) {
alert('I am 20px from the top of the window');
},
});