Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "carrossel", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "An agnostic framework carousel very easy to implement", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,4 +22,6 @@ let carouselElements | ||
updateButtons() | ||
arrowLeftElement.addEventListener('click', scrollToLeft) | ||
arrowRightElement.addEventListener('click', scrollToRight) | ||
carouselContainer.addEventListener('scroll', updateButtons) | ||
} | ||
@@ -43,2 +45,12 @@ | ||
function updateButtons() { | ||
arrowLeftElement.disabled = false | ||
arrowRightElement.disabled = false | ||
if (!carouselContainer.scrollLeft) { | ||
arrowLeftElement.disabled = true | ||
} else if (scrolledDistance() === carouselContainer.scrollWidth) { | ||
arrowRightElement.disabled = true | ||
} | ||
} | ||
function advancePointer() { | ||
@@ -64,2 +76,6 @@ let index = carouselElements.indexOf(currentElement) | ||
function scrolledDistance() { | ||
return carouselContainer.clientWidth + carouselContainer.scrollLeft | ||
} | ||
function getWidthPlusPaddingAndMargin(element) { | ||
@@ -66,0 +82,0 @@ return parseInt(window.getComputedStyle(element).width) + |
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
5632
79