How to launch callback when using jQuery Waypoints shortcut?

I want to switch the class of another element when waypoint('sticky') changes the class of the navigation bar. I tried to launch the callback using the handler parameter, but it does not work. What can I do?

+4
source share
1 answer

The callback option for waypoints is for some reason a β€œhandler”, so you can do it this way:

 $.waypoint('sticky', { handler: function(dir) { //Do stuff when the user scrolls past this waypoint. } }); 
+5
source

All Articles