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

Calculating computed width for container element #69

@mghdotdev

Description

@mghdotdev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions