jQuery – :animated Selector

The jQuery animated selector select all elements that are in the progress of an animation at the time the selector is run.

Source Code

<!DOCTYPE html>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
h2 { background:#98bf21;height:100px;width:100px; }
h2.colored { background:red; }
<button>Click Here</button>
function animated(){
	    width: ['toggle', 'swing'],
	    height: ['toggle', 'swing'],
	    opacity: 'toggle'
	}, 5000, 'linear',animated);

jQuery("button").click(function () {


Following example change the color of any element that is animated.


No comments yet.

Leave a Reply