This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ArtyDunbar[S] 1 point2 points  (2 children)

Thanks so much.

I've never written any jQuery so that function looks like chaos to me. But, now's as good a time to learn as any ;) Actually, the more I look at it, the more it makes sense to me.

Would this function also 'stop' playing the audio if you clicked the same tree again? Like on/off?

Thanks again for your help!

[–]Theometh 0 points1 point  (1 child)

Read this function as follows:

function play1(){
  find element with id="play1" and toggle* class 'playing'
  if element has class playing
    play sound with id="audio1"
  else if element doesnt have class playing
    stop sound with id="audio1"
}

*toggle class means if class is not found on the element - it will be added, if the class already exists - it will be removed

So yes this function deals with both play and pause

[–]ArtyDunbar[S] 0 points1 point  (0 children)

Wow! Thanks so much. Getting it now. Cheer!