made looping and autoplay in js
This commit is contained in:
parent
5b3e6b9187
commit
e4edf9901e
2 changed files with 8 additions and 2 deletions
|
@ -65,10 +65,10 @@
|
|||
</p>
|
||||
</div>
|
||||
<div onClick="showHelp()" id="openSideBar"><i class="fa fa-info-circle fa-lg"></i><span id ='helpText'> <i class="fa fa-arrow-left"><b> Help</b></i></span></div>
|
||||
<audio id="intro" autoplay>
|
||||
<audio id="intro">
|
||||
<source src="sounds/intro.ogg" type="audio/ogg">
|
||||
</audio >
|
||||
<audio id="loop" loop >
|
||||
<audio id="loop" >
|
||||
<source src="sounds/loop.ogg" type="audio/ogg">
|
||||
</audio>
|
||||
<div id="overlay" class="faded"></div>
|
||||
|
|
|
@ -172,10 +172,16 @@ function hideUIElements() {
|
|||
$('#startBtn').hide();
|
||||
}
|
||||
function loadListeners(){
|
||||
document.getElementById('intro').play();
|
||||
document.getElementById('intro').addEventListener('ended', function(){
|
||||
this.pause();
|
||||
toggleAudio();
|
||||
}, false);
|
||||
document.getElementById('loop').addEventListener('ended', function(){
|
||||
this.currentTime = 0;
|
||||
this.play();
|
||||
}, false);
|
||||
|
||||
}
|
||||
function toggleAudio(){
|
||||
var loopAudio = document.getElementById("loop");
|
||||
|
|
Loading…
Reference in a new issue