Skip to content

Instantly share code, notes, and snippets.

@j0lvera
Created March 22, 2013 01:17
Show Gist options
  • Save j0lvera/5218232 to your computer and use it in GitHub Desktop.
Save j0lvera/5218232 to your computer and use it in GitHub Desktop.
Color Animation - jQuery
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://raw.github.com/jquery/jquery-color/master/jquery.color.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div class="test">test</div>
<script>
var test = $('.test'),
a = true;
setInterval(function() {
if ( a === true ) {
test.animate({ backgroundColor: "red" }, "fast");
a = false;
} else {
test.animate({ backgroundColor: "yellow" }, "fast");
a = true;
}
}, 1500);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment