Pausing a function and then starting it again

Pausing a function and then starting it again

Hi all

I am running a function which is triggered by an audio track being played.(a rotating disc) I want to be able to pause it when the music is paused. The code is below

  $(document).foundation(); 
    $('audio').on('playing', function() { 
    rotateAnimation("img1", 10);
  });