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:
This one works better:
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 useresize
on non-window elements: