update js

master
sundowndev 2017-12-09 06:28:16 +01:00
parent 8498dfef64
commit b6c7aca000
2 changed files with 19 additions and 3 deletions

View File

@ -254,6 +254,7 @@ function run (difficulty) {
gameover.style.display = 'block';
playing = false;
clearInterval(ntm);
nanoPlayer.pause();
}
}, difficulty);
@ -262,9 +263,10 @@ function run (difficulty) {
}
var replay = document.querySelector('.replay');
var startmenu = document.querySelector('.startmenu');
var easy = document.querySelector('.play.easy');
var hard = document.querySelector('.play.hard');
var startmenu = document.querySelector('.startmenu');
var mute = document.querySelector('#mute');
replay.addEventListener('click', function(){
run('easy');
@ -273,9 +275,23 @@ replay.addEventListener('click', function(){
easy.addEventListener('click', function(){
run('easy');
startmenu.style.display = 'none';
nanoPlayer.play();
});
hard.addEventListener('click', function(){
run('hard');
startmenu.style.display = 'none';
nanoPlayer.play();
});
mute.addEventListener('click', function(e){
var mute = document.querySelector('#mute');
if(mute.classList.contains('mute-off')){
mute.classList.remove('mute-off');
nanoPlayer.play();
}else{
mute.classList.add('mute-off');
nanoPlayer.pause();
}
});

View File

@ -30,7 +30,7 @@
<a href="#" class="play hard">Pas facile</a>
<img src="assets/img/tank.png" alt="tank">
</div>
<div id="mute" class="mute mute-off"></div>
<div id="mute" class="mute"></div>
<div class="line line-1">
<div class="col col-1"></div>
<div class="col col-2"></div>
@ -261,7 +261,7 @@
<script>
var nanoPlayer = new nanoPlayer('.nano-player', {
// Parameters
autoplay: true,
autoplay: false,
loop: true,
defaultVolume: 100,
songList: [