Andy Macaulay-Brook
Andy Macaulay-Brook

Reputation: 127

Attempt to set Waypoints scrollThrottle value causes undefined object error

I've got jQuery Waypoints working fine, using the Inview shortcut.

jQuery(document).ready(function($) {

    //$.waypoints.settings.scrollThrottle = 0;

    var inview = new Waypoint.Inview({
        element: $('body > footer')[0],
        enter: function(direction) {
            $('body > header').css({
                bottom: 240,
                position: 'absolute'
            })
        },
        exited: function(direction) {
            $('body > header').css({
                bottom: 32,
                position: 'fixed'
            })
        }
    });

});

The page's header sits 32px above the bottom of the window in fixed position until the footer scrolls into view, at which point the header is made position absolute (the body is the positioning context) to give the effect of the emerging footer pushing the header up the page as it emerges.

Scrolling the footer away of the bottom reverses things.

Great, but it's a little jumpy so I wanted to play with the scroll throttle value. But if I uncomment the line that attempts to set scrollThrottle, I get: TypeError: undefined is not an object (evaluating '$.waypoints.settings')

I'm probably being incredibly stupid somewhere, but can't see it. Thanks.

Upvotes: 0

Views: 334

Answers (1)

Andy Macaulay-Brook
Andy Macaulay-Brook

Reputation: 127

The answer, (props to @andreivictor), is that scrollThrottle was removed from Waypoints in version 4 and so of course is undefined.

Upvotes: 1

Related Questions