miniplayer: add pause when going on music page
This commit is contained in:
parent
56079dc0dc
commit
82f4d4513a
3 changed files with 16 additions and 1 deletions
|
|
@ -108,6 +108,17 @@ function initMiniPlayer() {
|
||||||
handlePlayPause();
|
handlePlayPause();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
audio.addEventListener("pause", () => {
|
||||||
|
isPlaying = false;
|
||||||
|
updatePlayState();
|
||||||
|
});
|
||||||
|
|
||||||
|
audio.addEventListener("play", () => {
|
||||||
|
isPlaying = true;
|
||||||
|
updatePlayState();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
initMiniPlayer();
|
initMiniPlayer();
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@
|
||||||
if (miniplayer) {
|
if (miniplayer) {
|
||||||
miniplayer.style.display = isMusicPage ? 'none' : '';
|
miniplayer.style.display = isMusicPage ? 'none' : '';
|
||||||
}
|
}
|
||||||
|
if (isMusicPage) {
|
||||||
|
const audio = document.querySelector('mini-player audio');
|
||||||
|
if (audio) audio.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNavState() {
|
function updateNavState() {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
<a href="https://www.instagram.com/agahnim_music/" target="_blank"><img src="/static/assets/icons/insta.webp"
|
<a href="https://www.instagram.com/agahnim_music/" target="_blank"><img src="/static/assets/icons/insta.webp"
|
||||||
width="30px" /></a>
|
width="30px" /></a>
|
||||||
</socials>
|
</socials>
|
||||||
<img src="/static/assets/gifs/divider2.gif" />
|
<img width="200px" src="/static/assets/gifs/divider2.gif" />
|
||||||
</box>
|
</box>
|
||||||
</boxes>
|
</boxes>
|
||||||
</home-content>
|
</home-content>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue