Skip to content

Commit

Permalink
Fix scrollbar padding not being added when body does not have padding…
Browse files Browse the repository at this point in the history
…-right style (#19)
  • Loading branch information
Blasz authored and jossmac committed Apr 5, 2018
1 parent 43fd2fe commit 859b016
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class ScrollLock extends Component<Props> {

// apply the lock styles and padding if this is the first scroll lock
if (accountForScrollbars && activeScrollLocks < 1) {
const currentPadding = parseInt(this.originalStyles.paddingRight, 10);
const currentPadding = parseInt(this.originalStyles.paddingRight, 10) || 0;
const clientWidth = document.body ? document.body.clientWidth : 0;
const adjustedPadding =
window.innerWidth - clientWidth + currentPadding || 0;
Expand Down

0 comments on commit 859b016

Please sign in to comment.