I’ve got some h and img elements which are children of a li. When the user clicks on the li I want to hide these and make a progress bar appear. I have the appearing/disappearing of the items working but don’t know how to set the progress bar to initially not be shown.
Here’s the code:
<li id="li1"">
<img id = "track_image" src="image.jpg" />
<h1 id = "track_title">Title</h1>
<h2 id = "artist_name">Name"</h2>
<audio id="audio1"></audio>
div id="progressBar"><span id="progress"></span></div>
</li>
function audioClick(evt, listElementId, audioId, clip) {
var listElement = document.getElementById(listElementId);
var title = listElement.getElementsByTagName("h1")[0];
hideOrShowElement(title);
var artist = listElement.getElementsByTagName("h2")[0];
hideOrShowElement(artist);
var date = listElement.getElementsByTagName("h3")[0];
hideOrShowElement(date);
var audio = document.getElementById(audioId);
if (audio.paused) {
audio.src = clip;
audio.play();
}
else {
audio.pause();
audio.currentTime = 0;
}
}
function hideOrShowElement(element) {
if(element.style.display == 'none')
element.style.display = 'block';
else
element.style.display = 'none';
}
I want to add a progress bar when the audio plays, so was thinking of incorporating the progress bar here
But I don’t know how to initially set it so that its not displayed.
Thanks
Do this on page load
and on click