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?
You 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With