Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Video 84 - Project 2 - Spotify Clone/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,24 @@ body {
cursor: pointer;
}


.progress {
position: absolute;
height: 100%;
width: 0%;
background: #0b44ff; /* filled color */
border-radius: 3px;
}


.seekbar:hover .progress{
background-color: #E0209B;
}

.seekbar:hover .circle{
display: block;
}

.circle {
width: 13px;
height: 13px;
Expand All @@ -277,6 +295,7 @@ body {
bottom: 5px;
left: 0%;
transition: left 0.5s;
display: none;
}

.songbuttons img {
Expand Down
1 change: 1 addition & 0 deletions Video 84 - Project 2 - Spotify Clone/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h1>Spotify Playlists</h1>
<div class="cardContainer"> </div>
<div class="playbar">
<div class="seekbar">
<div class="progress"></div>
<div class="circle">

</div>
Expand Down
19 changes: 19 additions & 0 deletions Video 84 - Project 2 - Spotify Clone/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,25 @@ async function main() {
currentSong.currentTime = ((currentSong.duration) * percent) / 100
})

let seekbar = document.querySelector(".seekbar");
let progress = document.querySelector(".progress");


// event listener for the progress of current songs
seekbar.addEventListener("click", (e) => {
let percent = (e.offsetX / seekbar.getBoundingClientRect().width) * 100;
progress.style.width = percent + "%";

currentSong.currentTime = (currentsong.duration) * percent / 100;
});

// auto update while playing
currentSong.addEventListener("timeupdate", () => {
let percent = (currentSong.currentTime / currentSong.duration) * 100;
progress.style.width = percent + "%";
});


// Add an event listener for hamburger
document.querySelector(".hamburger").addEventListener("click", () => {
document.querySelector(".left").style.left = "0"
Expand Down