From f266c1d1f7df507cbdf26581e59ef0a39ecea42f Mon Sep 17 00:00:00 2001 From: AMD <90222287+michojekunle@users.noreply.github.com> Date: Wed, 7 Jun 2023 00:43:47 +0100 Subject: [PATCH] Update main.js --- main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 06cb0eb..7a9722f 100644 --- a/main.js +++ b/main.js @@ -61,24 +61,24 @@ const generateAdvice = () => { } // Added event Listener that listens for a click event on the dice Button -diceButton.addEventListener('click', () => { - showSlideshow = false; +diceButton.addEventListener('click', () => { + showSlideshow = !showSlideshow; audio.pause(); - slideShow.classList.remove('animate-pulse'); // Add Shadow && Animation to the button diceButton.classList.remove('shadow-3xl'); diceButton.classList.remove('shadow-neonGreen'); diceButton.classList.remove('animate-pulse'); - //Generate Advice - generateAdvice(); + // Generate Advice if slideshow is not going on + if(!showSlideshow) { + generateAdvice(); + } }); //Added Event Listener to listen for slideshow event on click of the slideshow button slideShow.addEventListener('click', () => { showSlideshow = !showSlideshow; - slideShow.classList.toggle('animate-pulse');//Added pulse animation whenever the slideshow button is clicked // Add Shadow && Animation to the button diceButton.classList.toggle('shadow-3xl');