admin管理员组文章数量:1389783
I'm using something like this to capture scroll events on a web page:
var myblock = new Waypoint.Inview({
element: $('#block')[0],
entered: function(direction) {
//do stuff
},
exited: function(direction) {
if(direction === "down") {
// do other stuff
}
}
});
The problem is that I have a sticky menu with a height of 100px at the top, and that I need Waypoint to trigger when some <div id="block">
touches that menu. Right now, the Waypoint code is triggered when <div id="block">
reaches the top of the viewport, where part of the div
is already under the menu.
I tried adding the offset
parameter but I don't see any changes
var myblock = new Waypoint.Inview({
element: $('#block')[0],
entered: function(direction) {
//do stuff
},
exited: function(direction) {
if(direction == "down") {
// do other stuff
}
},
offset: 100 // ADDED, NOTHING CHANGED
});
What am I doing wrong?
I'm using something like this to capture scroll events on a web page:
var myblock = new Waypoint.Inview({
element: $('#block')[0],
entered: function(direction) {
//do stuff
},
exited: function(direction) {
if(direction === "down") {
// do other stuff
}
}
});
The problem is that I have a sticky menu with a height of 100px at the top, and that I need Waypoint to trigger when some <div id="block">
touches that menu. Right now, the Waypoint code is triggered when <div id="block">
reaches the top of the viewport, where part of the div
is already under the menu.
I tried adding the offset
parameter but I don't see any changes
var myblock = new Waypoint.Inview({
element: $('#block')[0],
entered: function(direction) {
//do stuff
},
exited: function(direction) {
if(direction == "down") {
// do other stuff
}
},
offset: 100 // ADDED, NOTHING CHANGED
});
What am I doing wrong?
Share Improve this question asked Mar 30, 2015 at 13:03 RRikeshRRikesh 14.4k5 gold badges53 silver badges74 bronze badges1 Answer
Reset to default 7You are doing nothing wrong. There is currently no support for offsets with the Inview shortcut. At this time you will have to write it using a couple regular Waypoints.
本文标签: javascriptOffset with WaypointInview()Stack Overflow
版权声明:本文标题:javascript - Offset with Waypoint.Inview() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744660785a2618233.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论