diff options
author | Matthew Kosarek <mattkae@protonmail.com> | 2021-10-05 07:23:29 -0400 |
---|---|---|
committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-10-05 07:23:29 -0400 |
commit | b1388b40b138e4440cda121b8044b26ae35759ef (patch) | |
tree | 121b9ab7d80256f69a7389e8199edae181081282 /index.js | |
parent | 2fff4c30c18a1b89c3240222cd915e7607563896 (diff) |
Minified images and added better scroll code to the canvas
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -36,7 +36,9 @@ function runCarousel() { } function updateCarousel() { - var children = imageContainer.children; + var children = imageContainer.children, + selectedChildPosition = -imageContainer.children[carouselPosition].offsetLeft + 240; + imageContainer.style.transform = 'translate(' + selectedChildPosition + 'px, 0)'; for (var i = 0; i < children.length; i++) { var image = children[i]; if (i !== carouselPosition) { @@ -52,7 +54,6 @@ function runCarousel() { } } - imageContainer.style.left = 'calc(' + (-carouselPosition * 252) + 'px + 50% - 120px)'; rightButton.style.visibility = (carouselPosition === numImages - 1) ? 'hidden' : 'visible'; leftButton.style.visibility = (carouselPosition === 0) ? 'hidden' : 'visible'; } |