2

I have a moving animation, however I want to pause the animation when the pause() function is called through user clicking a button. Not sure how to do this, any help will be appreciated.

What I have:

function pause() {
console.log("paused ok");
}

and html:

<img src="image1.gif" alt="img1" id="img1" style="width:300px;height:300px;">
<input id=pausebutton  class="button" type="button" value="Pause" name="pause_button"  onClick="pause()">
michelle9090
  • 267
  • 1
  • 4
  • 14

1 Answers1

0

Try this:

function pause() {
  console.log("paused ok");
  var animation = document.getElementById("img1");
  animation.pause();
}
lyndact
  • 1
  • 3
  • 23