# Pause and resume animation

**URL:** <https://forum.kirupa.com/t/pause-and-resume-animation/331969>\
**Category:** web dev\
**Created:** [December 11, 2013, 6:32am UTC](https://forum.kirupa.com/t/pause-and-resume-animation/331969 "2013-12-11T06:32:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeadlyDude](https://avatars.discourse-cdn.com/v4/letter/d/db5fbb/32.png) [@DeadlyDude](https://forum.kirupa.com/u/DeadlyDude)\
**Post date:** [December 11, 2013, 6:32am UTC](https://forum.kirupa.com/t/pause-and-resume-animation/331969/1 "2013-12-11T06:32:58Z")

</div>

Here is my animation code:

function AnimateBK(element,time) {  
currentElement = $(element);  
$({temporary\_x: 0, temporary\_y: 0}).animate({temporary\_x: -312, temporary\_y: 0}, {  
duration: time,  
step: function() {  
var position = Math.round(this.temporary\_x) + "px " + Math.round(this.temporary\_y) + “px”;  
$(element).css(“background-position”, position);  
}  
});

```
	}				

```

I want to pause and resume the animation of a current element on a button click.:sad:

Please help…:cry3:
