garand / sticky

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

Fix for resizing windows #100

Closed chrisbull closed 10 years ago

Mygod commented 10 years ago

This one works better:

for (var i = 0; i < sticked.length; i++) {
    var s = sticked[i].stickyElement;
    var p = s.parent();
    p.css('height', s.outerHeight());
    s.css('width', p.outerWidth());
}

EDIT: This one still has a bug in some rare cases. I recommend to use setInterval to update the width and height automatically since there seems to be no way to use resize on non-window elements:

setInterval(resizer, 500);