Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

Change order of getWidthFrom calculation to prevent innaccurate widths #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dpedu
Copy link

@dpedu dpedu commented Apr 2, 2015

This is to fix inaccurate widths being applied from getWidthFrom, under specific conditions:

  • box-sizing of the container is border-box
  • the container has left or right padding
  • the element being stickied is being used as getWidthFrom

Under these conditions, when the sticky element is changed to position:fixed, it's width becomes equal to the width of the container + left/right padding on the container (due to border-box). This can lead to unexpected widths being applied to the stick element. Calculating the width from getWidthFrom before setting position:fixed fixes this issue.

@duzun
Copy link
Contributor

duzun commented Apr 16, 2015

I think commit a429b78f from PR #148 addresses this issue. In that commit the width is applied exactly once, at once with position: fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants