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