Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fire a callback when using jQuery Waypoints Sticky Shortcut?

I want to toggle a class of another element whenever waypoint('sticky') changes the class of the navigation bar. I was trying to fire a callback using the handler option, but it does not work. What could I do?

like image 629
Lianzinho Avatar asked Jan 16 '13 17:01

Lianzinho


1 Answers

The callback option for Waypoints is, for some reason, "handler", so you could do it like this:

$.waypoint('sticky', {
    handler: function(dir) {
        //Do stuff when the user scrolls past this waypoint.
    }
});
like image 150
Micah Snyder Avatar answered Oct 29 '22 19:10

Micah Snyder