diff --git a/script.js b/script.js index 325d836..fddff68 100644 --- a/script.js +++ b/script.js @@ -1,5 +1,5 @@ document.addEventListener('DOMContentLoaded', function () { - // Elements for random suggestions + // Elements for random suggestions const resultDiv = document.getElementById('result'); const objects = ['Book', 'Chair', 'Laptop', 'Pen', 'Phone', 'Sock', 'Table', 'Umbrella', 'Wallet', 'Watch']; const relationships = ['Friend', 'Parent', 'Sibling', 'Colleague', 'Neighbor', 'Partner', 'Mentor', 'Student', 'Boss', 'Customer']; @@ -79,4 +79,21 @@ document.addEventListener('DOMContentLoaded', function () { // Initial display update for the timer updateDisplay(); + + // Add sound effect functionality + const bellSound = new Audio('sounds/bell.mp3'); // Update the path as needed + + resultDiv.addEventListener('click', function() { + bellSound.currentTime = 0; // Restart the audio from the beginning + bellSound.play(); // Play the sound effect + }); + + const buzzerSound = new Audio('sounds/buzzer.mp3'); + + timerDisplay.addEventListener('click', function() { + buzzerSound.currentTime = 0; + buzzerSound.play(); + }); + + }); diff --git a/sounds/bell.mp3 b/sounds/bell.mp3 new file mode 100644 index 0000000..c40f7b9 Binary files /dev/null and b/sounds/bell.mp3 differ diff --git a/sounds/buzzer.mp3 b/sounds/buzzer.mp3 new file mode 100644 index 0000000..cbc41a1 Binary files /dev/null and b/sounds/buzzer.mp3 differ diff --git a/styles.css b/styles.css index 7c813b9..f8df65c 100644 --- a/styles.css +++ b/styles.css @@ -30,3 +30,7 @@ height: 40px; transition: background-color 0.3s ease; /* Smooth transition for hover effect */ } + +#result { + cursor: pointer; /* Change cursor to indicate it's clickable */ +}