intro leads in and loop loops

This commit is contained in:
Garrett Finucane 2014-07-06 10:38:33 -04:00
parent 764eb702a2
commit 73d275857b
4 changed files with 14 additions and 8 deletions

View file

@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="style/style.css">
<link rel="stylesheet" href="style/fa/css/font-awesome.min.css">
</head>
<body onload="toggleAudio()">
<body onload="loadListeners()">
<canvas id="canvas"></canvas>
<div id='devtools' style='z-index:3;display:none;position:absolute;left:50%;width:400px;height:400px;top:50%;margin-top:-200px;margin-left:-200px;'>
<h2 id = 'clickToExit' style = 'background-color:#fff;color:#000'>Click to exit</h2>
@ -64,11 +64,11 @@
<a href = 'url'>Found a bug? Go here</a>
</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></span></div>
<audio id="intro">
<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>
<source src="sounds/intro.ogg" type="audio/ogg">
</audio >
<audio id="loop" autoplay loop="loop">
<audio id="loop" loop >
<source src="sounds/loop.ogg" type="audio/ogg">
</audio>
<div id="overlay" class="faded"></div>

View file

@ -171,11 +171,17 @@ function hideUIElements() {
$('#restartBtn').hide();
$('#startBtn').hide();
}
function loadListeners(){
document.getElementById('intro').addEventListener('ended', function(){
this.pause();
toggleAudio();
}, false);
}
function toggleAudio(){
var loopAudio = document.getElementById("loop");
if(loopAudio.paused) loopAudio.play();
else loopAudio.pause()
return loopAudio.paused
var loopAudio = document.getElementById("loop");
if(loopAudio.paused) loopAudio.play();
else loopAudio.pause()
return loopAudio.paused
}
function init(b) {

BIN
sounds/intro.ogg Normal file

Binary file not shown.

BIN
sounds/loop.ogg Normal file

Binary file not shown.