@dreamworld/web-util
Advanced tools
Comparing version 1.4.3-fix-visual-viewport-issue-for-ios.7 to 1.4.3
{ | ||
"name": "@dreamworld/web-util", | ||
"version": "1.4.3-fix-visual-viewport-issue-for-ios.7", | ||
"version": "1.4.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
const alignTop = (scrollingElement, element, offsetTop) => { | ||
console.log("alignTop ==> old-scrollTop", scrollingElement.scrollTop); | ||
console.log("alignTop ==> new-scrollTop", element.offsetTop - offsetTop); | ||
console.log("alignTop ==> element offsetTop", element.offsetTop); | ||
console.log("alignTop ==> offsetTop", offsetTop); | ||
scrollingElement.scrollTop = element.offsetTop - offsetTop; | ||
@@ -13,8 +9,2 @@ } | ||
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 - 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", scrollingElementClientHeight); | ||
scrollingElement.scrollTop = element.offsetTop + element.offsetHeight + offsetBottom - scrollingElementClientHeight; | ||
@@ -48,10 +38,2 @@ } | ||
} | ||
console.log("isFullVisible ==> scrollElementTop", scrollElementTop); | ||
console.log("isFullVisible ==> offsetTop", offsetTop); | ||
console.log("isFullVisible ==> scrollElementBottom", scrollElementBottom); | ||
console.log("isFullVisible ==> offsetBottom", offsetBottom); | ||
console.log("isFullVisible ==> elementRect.bottom", elementRect.bottom); | ||
console.log("isFullVisible ==> elementRect.top", elementRect.top); | ||
return true; | ||
@@ -75,7 +57,5 @@ } | ||
if (isFullVisible(scrollingElement, element, offsetTop, offsetBottom)) { | ||
console.log("fully visible"); | ||
return; | ||
} | ||
console.log("not fully visible"); | ||
let scrollingElementClientHeight = window.visualViewport ? window.visualViewport.height : scrollingElement.clientHeight; | ||
@@ -85,6 +65,4 @@ // If element client height > view-port's height | ||
if (!bottom) { | ||
console.log("align Top 1"); | ||
alignTop(scrollingElement, element, offsetTop); | ||
} else { | ||
console.log("align Bottom 1"); | ||
alignBottom(scrollingElement, element, offsetBottom); | ||
@@ -96,3 +74,2 @@ } | ||
if (element.offsetTop < (scrollingElement.scrollTop + offsetTop)) { | ||
console.log("align Top 2"); | ||
alignTop(scrollingElement, element, offsetTop); | ||
@@ -103,8 +80,5 @@ return; | ||
if((element.offsetTop + element.offsetHeight) > (scrollingElement.scrollTop + scrollingElementClientHeight - offsetBottom)) { | ||
console.log("align bottom 2"); | ||
alignBottom(scrollingElement, element, offsetBottom); | ||
return; | ||
} | ||
console.log("not work proper.") | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
14502
274