Animate demo: Don't use .toggle(fn).

This commit is contained in:
Scott González 2012-05-21 10:06:46 -04:00
parent 820cff8a67
commit 1da4d7e18d

View File

@ -15,22 +15,23 @@
</style>
<script>
$(function() {
$( "#button" ).toggle(
function() {
var state = true;
$( "#button" ).click(function() {
if ( state ) {
$( "#effect" ).animate({
backgroundColor: "#aa0000",
color: "#fff",
width: 500
}, 1000 );
},
function() {
} else {
$( "#effect" ).animate({
backgroundColor: "#fff",
color: "#000",
width: 240
}, 1000 );
}
);
state = !state;
});
});
</script>
</head>