garand / sticky

jQuery Plugin for Sticky Objects
Other
3.3k stars 1.06k forks source link

Resize issue #207

Closed wim-mertens closed 8 years ago

wim-mertens commented 8 years ago

I have an instance where on a different screen size it requires a different topSpacing, like this:

`$(function () { if ($(window).width() < 1006) { $(".search-within-holder").sticky({ topSpacing: 92, bottomSpacing: 267 });

} else {
    $(".search-within-holder").sticky({ topSpacing: 156, bottomSpacing: 267 });
}

});`

Problem is, it only fixes the topSpacing on refresh. Is there any way it can be updated on resizing the window?

Blackscr33n commented 8 years ago

Try this: $( window ).resize(function() { $('#header').sticky('update'); });

wim-mertens commented 8 years ago

Worked like a charm, thanks!