jeudi 13 août 2015

I want to combine first function to the second one, so I can call it only once

I want to combine first function to the second one, so I can call it only once. Basically i have 2 html5 audio files that im playing. Everything works fine.But if i play my first audio and during that time if i click the second audio the pause button on first audio doesn't change to default(off)

//First function 

function toggleState(item) {
  if (item.className == "play") {
    item.className = "pause";
  } else {
    item.className = "play";
  }
}

//Second function
// Play stop Music
function EvalSound(soundobj) {
  var thissound = document.getElementById(soundobj);
  if (thissound.paused) {
    thissound.play();
  } else {
    thissound.pause();
  }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire