summaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/index.js b/index.js
index 3397c30..72fcc2e 100644
--- a/index.js
+++ b/index.js
@@ -37,7 +37,8 @@ function runCarousel() {
function updateCarousel() {
var children = imageContainer.children,
- selectedChildPosition = -imageContainer.children[carouselPosition].offsetLeft + 240;
+ numChildren = imageContainer.children.length,
+ selectedChildPosition = -(carouselPosition * 240);
imageContainer.style.transform = 'translate(' + selectedChildPosition + 'px, 0)';
for (var i = 0; i < children.length; i++) {
var image = children[i];