]> source.dussan.org Git - jquery-ui.git/commitdiff
Animate demo: Don't use .toggle(fn).
authorScott González <scott.gonzalez@gmail.com>
Mon, 21 May 2012 14:06:46 +0000 (10:06 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 21 May 2012 14:06:46 +0000 (10:06 -0400)
demos/animate/default.html

index 4fec428e7ad9d4fc7a39659e5390ae8c922425c7..307d030a6cbcdad29bc857d14a23de8701e2c207 100644 (file)
        </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>