From c3bff045eb9e28e8e49d511c9e15e13db25a2319 Mon Sep 17 00:00:00 2001 From: mattkae Date: Wed, 29 Dec 2021 16:33:55 -0500 Subject: Improved image manipulation and loading --- index.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'index.js') diff --git a/index.js b/index.js index 7304870..acdbe49 100644 --- a/index.js +++ b/index.js @@ -1,22 +1,9 @@ function main() { - runCarousel(); + var themeSelector = document.getElementById('theme_selector'); + themeSelector.classList.remove('hidden'); - // // -- Note! We require a black background to properly see the WebGL, so we handle that here. - // var themeElement = document.getElementById('theme_container'); - // var themeButtonList = document.querySelectorAll('#theme_selector > button'); - // themeButtonList.forEach(function(themeButton) { - // if (themeButton.id !== 'theme_button_default') { - // themeButton.addEventListener('click', function() { - // themeElement.style.background = 'black'; - // }); - // } - // else { - // themeButton.addEventListener('click', function() { - // themeElement.style.background = 'white'; - // }); - // } - // }); + runCarousel(); } function runCarousel() { @@ -54,6 +41,7 @@ function runCarousel() { background.append(clone); clone.addEventListener('click', function(event) { event.stopPropagation(); }); background.addEventListener('click', function() { background.remove(); }); + window.addEventListener('keydown', function(e) { if (e.key === 'Escape') background.remove(); }); document.body.parentElement.prepend(background); } @@ -95,6 +83,9 @@ function runCarousel() { leftButton.addEventListener('click', onCarouselLeft); rightButton.addEventListener('click', onCarouselRight); + + // -- Fade in the container + imageContainer.style.opacity = '1'; } -document.onload = main; +window.onload = main; -- cgit v1.2.1