waypoints
waypoints copied to clipboard
Multiple waypoints on a single element via "new Waypoint(options)" method not allowed
It doesn't appear that multiple waypoints attached to a single element are being handled correctly when created via the new Waypoint() method.
I'm attempting to attach two waypoints to an element to handle scrolling up the element and down to the element, each with different offset values:
$('.dynamicElement').each(function () {
var elNearViewportWaypoint,
elNearViewportWaypoint_ScrollingUp,
el = this;
// Watch for entry of ad into area surrounding viewport; load it
elNearViewportWaypoint = new Waypoint({
element: el,
handler: function (direction) {
if (direction === 'down') {
dynamicallyDoAThing(direction);
adNearViewportWaypoint.destroy();
}
},
offset: '150%'
});
elNearViewportWaypoint_scrollingUP= new Waypoint({
element: el,
handler: function (direction) {
if (direction === 'up') {
dynamicallyDoAThing(direction);
adNearViewportWaypoint_scrollingUP.destroy();
}
},
offset: 0
});
function dynamicallyDoAThing(direction){
//functionality
}
});
I don't appear to the only one experiencing similar issues as it is mentioned here and includes a link to an example.