1.5 Music added
This commit is contained in:
parent
fb15a0747a
commit
08fe9491a0
@ -189,3 +189,16 @@ body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 2rem 0;
|
padding: 2rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#music-toggle {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
padding: 10px 15px;
|
||||||
|
background-color: #333;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
17
assets/js/main.js
Normal file
17
assets/js/main.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const music = document.getElementById('background-music');
|
||||||
|
const musicToggle = document.getElementById('music-toggle');
|
||||||
|
|
||||||
|
if (music && musicToggle) {
|
||||||
|
musicToggle.addEventListener('click', function() {
|
||||||
|
if (music.paused) {
|
||||||
|
music.play();
|
||||||
|
musicToggle.textContent = 'Pause Music';
|
||||||
|
} else {
|
||||||
|
music.pause();
|
||||||
|
musicToggle.textContent = 'Play Music';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -32,6 +32,8 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<audio id="background-music" src="https://www.bensound.com/bensound-music/bensound-rainyday.mp3" loop></audio>
|
||||||
|
<button id="music-toggle">Play Music</button>
|
||||||
|
|
||||||
<header class="main-header">
|
<header class="main-header">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@ -138,5 +140,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user