Halian Vilela
Halian Vilela

Reputation: 381

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?

Upvotes: 5

Views: 2481

Answers (1)

Micah Snyder
Micah Snyder

Reputation: 503

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.
    }
});

Upvotes: 6

Related Questions