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

Calculating computed width for container element #69

Open
mghdotdev opened this issue Mar 9, 2020 · 0 comments
Open

Calculating computed width for container element #69

mghdotdev opened this issue Mar 9, 2020 · 0 comments

Comments

@mghdotdev
Copy link

I am noticing an issue with the width/height calculation for container elements and how it translates to the static width after becoming sticky.

If the container element has padding the sticky element is still set to the full width of the element. This causes layout issues for the sticky element.

Could you update your plugin to at least have the following calculation be an option?

  var styles = window.getComputedStyle(element);
  var padding = parseFloat(styles.paddingLeft) +
                parseFloat(styles.paddingRight);

  return element.clientWidth - padding;
}```

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

No branches or pull requests

1 participant