0
Where to go from here
How am I gonna make the screen work still learning JavaScript more will do the functioning myself but the screen is where I need help on. Any advice? https://sololearn.com/compiler-playground/Wns9FSJwsQYf/?ref=app https://sololearn.com/compiler-playground/Wns9FSJwsQYf/?ref=app
1 Réponse
+ 1
1. HTML Structure: You need a basic layout with a div for your player, an audio element for the song, and buttons for play/pause.
<div class="player">
<audio id="audio" src="your-audio-file.mp3"></audio>
<button id="play">Play</button>
<button id="pause">Pause</button>
</div>
2. CSS Styling: Style it with CSS to make it look clean and simple.
.player {
background-color: #1e1e1e;
padding: 20px;
text-align: center;
}
button {
background-color: #ff4081;
color: white;
padding: 10px;
}
3. JavaScript: Make your play and pause buttons work.
const audio = document.getElementById('audio');
document.getElementById('play').addEventListener('click', () => audio.play());
document.getElementById('pause').addEventListener('click', () => audio.pause());