diff options
author | mattkae <mattkae@protonmail.com> | 2022-06-22 21:04:35 -0400 |
---|---|---|
committer | mattkae <mattkae@protonmail.com> | 2022-06-22 21:04:35 -0400 |
commit | ada7e2de99de2b87f5a1ca3ba7f1896c8a664d21 (patch) | |
tree | 56a7d79df5d3929db33288c5a94a5403d6efc045 /index.js~ | |
parent | 29059f552223d70bdab287b0d121567cec0ed6c7 (diff) |
Remove leftover files
Diffstat (limited to 'index.js~')
-rw-r--r-- | index.js~ | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/index.js~ b/index.js~ deleted file mode 100644 index 1ccc88c..0000000 --- a/index.js~ +++ /dev/null @@ -1,70 +0,0 @@ - -function main() { - runCarousel(); - runPosts(); -} - -function runCarousel() { - var carouselContainer = document.getElementById("carousel"), - imageContainer = document.getElementById('image_container'), - leftButton = document.getElementById('carousel_left'), - rightButton = document.getElementById('carousel_right'); - - // Carousel logic - var carouselPosition = 1, - numImages = imageContainer.children.length; - - function onCarouselRight() { - carouselPosition = (carouselPosition + 1); - - if (carouselPosition === numImages) { - carouselPosition = 0; - } - updateCarousel(); - } - - function onCarouselLeft() { - carouselPosition = (carouselPosition - 1); - if (carouselPosition < 0) { - carouselPosition = numImages - 1; - } - updateCarousel(); - } - - function onImageClicked() { - - } - - function updateCarousel() { - var children = imageContainer.children; - for (var i = 0; i < children.length; i++) { - var image = children[i]; - if (i !== carouselPosition) { - if (i === (carouselPosition - 1) % numImages) { - image.style.opacity = 0.3; - } else if (i !== 0 && i === (carouselPosition + 1) % numImages) { - image.style.opacity = 0.3; - } else { - image.style.opacity = 0; - } - } else { - image.style.opacity = 1; - } - } - - imageContainer.style.left = 'calc(' + (-carouselPosition * 252) + 'px + 50% - 120px)'; - rightButton.style.visibility = (carouselPosition === numImages - 1) ? 'hidden' : 'visible'; - leftButton.style.visibility = (carouselPosition === 0) ? 'hidden' : 'visible'; - } - - updateCarousel(); - - leftButton.addEventListener('click', onCarouselLeft); - rightButton.addEventListener('click', onCarouselRight); -} - -function runPosts() { - -} - -main(); |