From 7f69cdb1e95c0057031e9ad7163b9796853345a1 Mon Sep 17 00:00:00 2001 From: VCji21 Date: Fri, 13 Feb 2026 18:27:53 +0530 Subject: [PATCH] change button to play when song is over. --- Video 84 - Project 2 - Spotify Clone/js/script.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Video 84 - Project 2 - Spotify Clone/js/script.js b/Video 84 - Project 2 - Spotify Clone/js/script.js index 32e76b89..a54ccc26 100644 --- a/Video 84 - Project 2 - Spotify Clone/js/script.js +++ b/Video 84 - Project 2 - Spotify Clone/js/script.js @@ -138,8 +138,13 @@ async function main() { // Listen for timeupdate event currentSong.addEventListener("timeupdate", () => { - document.querySelector(".songtime").innerHTML = `${secondsToMinutesSeconds(currentSong.currentTime)} / ${secondsToMinutesSeconds(currentSong.duration)}` - document.querySelector(".circle").style.left = (currentSong.currentTime / currentSong.duration) * 100 + "%"; + let timetake = secondsToMinutesSeconds(currentSong.currentTime) + let totaltime = secondsToMinutesSeconds(currentSong.duration) + document.querySelector(".songtime").innerHTML = timetake + ' / ' + totaltime; + document.querySelector(".circle").style.left = (currentSong.currentTime / currentSong.duration) * 100 + '%'; + if (timetake == totaltime) { + play.src = "img/play.svg" + } }) // Add an event listener to seekbar @@ -210,4 +215,4 @@ async function main() { } -main() \ No newline at end of file +main()