From 06178a8143f8ecae0f93f5924becef3df46ebe1e Mon Sep 17 00:00:00 2001 From: ankitjhagithub21 Date: Sat, 11 Nov 2023 17:52:12 +0530 Subject: [PATCH] added diwali wisher --- index.html | 33 +++++++++++++++++++++------------ script.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ style.css | 3 +++ 3 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 script.js diff --git a/index.html b/index.html index fb9bbd9..e33e2e4 100644 --- a/index.html +++ b/index.html @@ -14,21 +14,30 @@
+
diya

Wishing You Sparking festival of lights, Happy Diwali !!

- +
+ + +
+
+ + +
+

Diwali Wish Generator

+
+ +
+
+ + + +
+
- + + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..834aaca --- /dev/null +++ b/script.js @@ -0,0 +1,46 @@ + +var audio = document.getElementById('audio') +function playAudio() { + if (audio.paused) { + audio.play(); + } else { + audio.pause(); + audio.currentTime = 0; + } +} + +const diwaliWishes = [ + "Wishing you a Diwali full of joy and prosperity!", + "May the Festival of Lights brighten your life with happiness and success.", + "May this Diwali bring good health, wealth, and happiness to you and your family.", + "Wishing you a year filled with love, light, and laughter. Happy Diwali!", + "May the divine light of Diwali spread into your life peace, prosperity, happiness, and good health.", + "Wishing you a sparkling Diwali and a year filled with warmth and love.", + "May the beauty of Diwali fill your home with happiness, and may the coming year provide you with everything you've been searching for." +]; + +const wishContainer = document.getElementById("random-wish"); +const generateButton = document.getElementById("generate-wish"); +const copyButton = document.getElementById("copy-wish"); +const wishBox = document.getElementById('wish-box') +const home = document.getElementById('home') + +generateButton.addEventListener("click", () => { + const randomIndex = Math.floor(Math.random() * diwaliWishes.length); + const randomWish = diwaliWishes[randomIndex]; + wishContainer.textContent = randomWish; + +}); + +copyButton.addEventListener("click", () => { + var copyText = wishContainer.value; + navigator.clipboard.writeText(copyText).then(() => { + alert("Wish copied to clipboard!"); + }); + +}); + +function displayWisher(){ + home.style.display="none" + wishBox.style.display="block" +} \ No newline at end of file diff --git a/style.css b/style.css index a533492..bba124d 100644 --- a/style.css +++ b/style.css @@ -24,3 +24,6 @@ h1,h2{ } +#wish-box{ + display: none; +} \ No newline at end of file