@dreamworld/web-util
Advanced tools
Comparing version 1.4.3-fix-visual-viewport-issue-for-ios.6 to 1.4.3-fix-visual-viewport-issue-for-ios.7
{ | ||
"name": "@dreamworld/web-util", | ||
"version": "1.4.3-fix-visual-viewport-issue-for-ios.6", | ||
"version": "1.4.3-fix-visual-viewport-issue-for-ios.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,9 +12,10 @@ | ||
const alignBottom = (scrollingElement, element, offsetBottom) => { | ||
let scrollingElementClientHeight = window.visualViewport ? window.visualViewport.height : scrollingElement.clientHeight; | ||
console.log("alignBottom ==> old-scrollTop", scrollingElement.scrollTop); | ||
console.log("alignBottom ==> new-scrollTop", element.offsetTop + element.offsetHeight + offsetBottom - scrollingElement.clientHeight); | ||
console.log("alignBottom ==> new-scrollTop", element.offsetTop + element.offsetHeight + offsetBottom - scrollingElementClientHeight); | ||
console.log("alignBottom ==> element offsetTop", element.offsetTop); | ||
console.log("alignBottom ==> element offsetHeight", element.offsetHeight); | ||
console.log("alignBottom ==> offsetBottom", offsetBottom); | ||
console.log("alignBottom ==> scrollingElement clientHeight", scrollingElement.clientHeight); | ||
scrollingElement.scrollTop = element.offsetTop + element.offsetHeight + offsetBottom - scrollingElement.clientHeight; | ||
console.log("alignBottom ==> scrollingElement clientHeight", scrollingElementClientHeight); | ||
scrollingElement.scrollTop = element.offsetTop + element.offsetHeight + offsetBottom - scrollingElementClientHeight; | ||
} | ||
@@ -78,4 +79,5 @@ | ||
console.log("not fully visible"); | ||
let scrollingElementClientHeight = window.visualViewport ? window.visualViewport.height : scrollingElement.clientHeight; | ||
// If element client height > view-port's height | ||
if (element.clientHeight > (scrollingElement.clientHeight - (offsetTop + offsetBottom))) { | ||
if (element.clientHeight > (scrollingElementClientHeight - (offsetTop + offsetBottom))) { | ||
if (!bottom) { | ||
@@ -97,3 +99,3 @@ console.log("align Top 1"); | ||
if((element.offsetTop + element.offsetHeight) > (scrollingElement.scrollTop + scrollingElement.clientHeight - offsetBottom)) { | ||
if((element.offsetTop + element.offsetHeight) > (scrollingElement.scrollTop + scrollingElementClientHeight - offsetBottom)) { | ||
console.log("align bottom 2"); | ||
@@ -100,0 +102,0 @@ alignBottom(scrollingElement, element, offsetBottom); |
15979
297