Comparing version 1.3.1 to 1.4.0
18
index.js
@@ -20,3 +20,3 @@ let carouselElements | ||
if (carouselContainer.clientWidth > getTotalWidthOfItems()) return | ||
if (carouselContainer.clientWidth > carouselContainer.scrollWidth) return | ||
@@ -69,8 +69,2 @@ updateButtons() | ||
function getTotalWidthOfItems() { | ||
return carouselElements | ||
.map(element => getWidthPlusPaddingAndMargin(element)) | ||
.reduce((acc, cur) => acc + cur) | ||
} | ||
function scrolledDistance() { | ||
@@ -81,7 +75,7 @@ return carouselContainer.clientWidth + carouselContainer.scrollLeft | ||
function getWidthPlusPaddingAndMargin(element) { | ||
return parseInt(window.getComputedStyle(element).width) + | ||
parseInt(window.getComputedStyle(element).paddingLeft) + | ||
parseInt(window.getComputedStyle(element).paddingRight) + | ||
parseInt(window.getComputedStyle(element).marginLeft) + | ||
parseInt(window.getComputedStyle(element).marginRight) | ||
return parseFloat(window.getComputedStyle(element).width) + | ||
parseFloat(window.getComputedStyle(element).paddingLeft) + | ||
parseFloat(window.getComputedStyle(element).paddingRight) + | ||
parseFloat(window.getComputedStyle(element).marginLeft) + | ||
parseFloat(window.getComputedStyle(element).marginRight) | ||
} |
{ | ||
"name": "carrossel", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "An agnostic framework carousel very easy to implement", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
3376
67