Skip to content

Commit

Permalink
fix native scrollbars appearing when applying padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Grsmto committed Nov 2, 2018
1 parent 0c73bfd commit a7d0f52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/simplebar/src/simplebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export default class SimpleBar {
).length
) {
// assume that element has his DOM already initiated
this.wrapperEl = this.el.querySelector(`.${this.classNames.wrapper}`);
this.contentEl = this.el.querySelector(`.${this.classNames.content}`);
this.offsetEl = this.el.querySelector(`.${this.classNames.offset}`);
this.maskEl = this.el.querySelector(`.${this.classNames.mask}`);
Expand Down Expand Up @@ -366,7 +367,8 @@ export default class SimpleBar {

this.placeholderEl.style.width = `${this.contentEl.scrollWidth}px`;
this.placeholderEl.style.height = `${this.contentEl.scrollHeight}px`;
this.placeholderEl.style.margin = `-${this.elStyles.paddingTop} -${this.elStyles.paddingRight} -${this.elStyles.paddingBottom} -${this.elStyles.paddingLeft}`;

this.wrapperEl.style.margin = `-${this.elStyles.paddingTop} -${this.elStyles.paddingRight} -${this.elStyles.paddingBottom} -${this.elStyles.paddingLeft}`;

this.axis.x.track.rect = this.axis.x.track.el.getBoundingClientRect();
this.axis.y.track.rect = this.axis.y.track.el.getBoundingClientRect();
Expand Down

0 comments on commit a7d0f52

Please sign in to comment.