@dreamworld/web-util
Advanced tools
Comparing version 1.4.3-fix-visual-viewport-issue-for-ios.5 to 1.4.3-fix-visual-viewport-issue-for-ios.6
{ | ||
"name": "@dreamworld/web-util", | ||
"version": "1.4.3-fix-visual-viewport-issue-for-ios.5", | ||
"version": "1.4.3-fix-visual-viewport-issue-for-ios.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,7 +22,6 @@ | ||
const isFullVisible = (scrollElement, element, offsetTop, offsetBottom) => { | ||
const scrollElementRect = scrollElement.getBoundingClientRect(); | ||
const elementRect = element.getBoundingClientRect(); | ||
let scrollElementTop = scrollElementRect.top; | ||
let scrollElementBottom = scrollElementRect.bottom; | ||
let scrollElementTop; | ||
let scrollElementBottom; | ||
@@ -32,4 +31,13 @@ //If given scrolling element as a document scroll | ||
if(document.scrollingElement === scrollElement) { | ||
scrollElementTop = 0; | ||
scrollElementBottom = window.visualViewport && window.visualViewport.height || window.innerHeight; | ||
if(window.visualViewport) { | ||
scrollElementTop = window.visualViewport.offsetTop; | ||
scrollElementBottom = window.visualViewport.height; | ||
} else { | ||
scrollElementTop = 0; | ||
scrollElementBottom = window.innerHeight; | ||
} | ||
} else { | ||
const scrollElementRect = scrollElement.getBoundingClientRect(); | ||
scrollElementTop = scrollElementRect.top; | ||
scrollElementBottom = scrollElementRect.bottom; | ||
} | ||
@@ -36,0 +44,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15738
295