Skip to content

Commit

Permalink
Merge pull request #228 from mindnektar/fix/issue-182
Browse files Browse the repository at this point in the history
fix: add px to positional css values for ios devices
  • Loading branch information
willmcpo committed Aug 14, 2021
2 parents 157d235 + 5b3ffa2 commit 79c4cf2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions lib/bodyScrollLock.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ const setPositionFixed = () => window.requestAnimationFrame(() => {
left: document.body.style.left
};

// Update the dom inside an animation frame
// Update the dom inside an animation frame
const { scrollY, scrollX, innerHeight } = window;
document.body.style.position = 'fixed';
document.body.style.top = -scrollY;
document.body.style.left = -scrollX;
document.body.style.top = `${-scrollY}px`;
document.body.style.left = `${-scrollX}px`;

setTimeout(() => window.requestAnimationFrame(() => {
// Attempt to check if the bottom bar appeared due to the position change
Expand Down
6 changes: 3 additions & 3 deletions lib/bodyScrollLock.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ var setPositionFixed = function setPositionFixed() {
left: document.body.style.left
};

// Update the dom inside an animation frame
// Update the dom inside an animation frame
var _window = window,
scrollY = _window.scrollY,
scrollX = _window.scrollX,
innerHeight = _window.innerHeight;

document.body.style.position = 'fixed';
document.body.style.top = -scrollY;
document.body.style.left = -scrollX;
document.body.style.top = -scrollY + 'px';
document.body.style.left = -scrollX + 'px';

setTimeout(function () {
return window.requestAnimationFrame(function () {
Expand Down
6 changes: 3 additions & 3 deletions lib/bodyScrollLock.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@
left: document.body.style.left
};

// Update the dom inside an animation frame
// Update the dom inside an animation frame
var _window = window,
scrollY = _window.scrollY,
scrollX = _window.scrollX,
innerHeight = _window.innerHeight;

document.body.style.position = 'fixed';
document.body.style.top = -scrollY;
document.body.style.left = -scrollX;
document.body.style.top = -scrollY + 'px';
document.body.style.left = -scrollX + 'px';

setTimeout(function () {
return window.requestAnimationFrame(function () {
Expand Down
2 changes: 1 addition & 1 deletion lib/bodyScrollLock.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/bodyScrollLock.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ const setPositionFixed = () => window.requestAnimationFrame(() => {
top: document.body.style.top,
left: document.body.style.left
};
// Update the dom inside an animation frame

// Update the dom inside an animation frame
const { scrollY, scrollX, innerHeight } = window;
document.body.style.position = 'fixed';
document.body.style.top = -scrollY;
document.body.style.left = -scrollX;
document.body.style.top = `${-scrollY}px`;
document.body.style.left = `${-scrollX}px`;

setTimeout(() => window.requestAnimationFrame(() => {
// Attempt to check if the bottom bar appeared due to the position change
Expand Down Expand Up @@ -241,7 +241,7 @@ export const clearAllBodyScrollLocks = (): void => {
// Reset initial clientY.
initialClientY = -1;
}

if (isIosDevice) {
restorePositionSetting();
} else {
Expand Down

0 comments on commit 79c4cf2

Please sign in to comment.