garand / sticky

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

After resizing HTML document width changes if sticky element "left" position is not zero. #165

Open selifan opened 9 years ago

selifan commented 9 years ago

If I attach sticky element to my div absolutely positioned with non-zero "left" value, after resizing window I see horizontal scroll and "parasite" empty bar on the right of my document. It's width is exactly as "left" position of sticky element. Because You don't care about sticky left position.

I could fix it by adding code at the line 116 (sticky version 1.0.2): Before change:

            s.stickyElement.css('width', newWidth);

After change:

            var lfpos = (s.stickyElement.css('left') || 0);
            s.stickyElement.css('width', newWidth - lfpos);