diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-05-21 10:02:57 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-05-21 10:02:57 -0400 |
commit | 33a91fb19e19e238a4f841908f2a0c8d56fa2162 (patch) | |
tree | 4624d7f678cb0f11e98dd3de1c526bd95c74ffae /demos/spinner | |
parent | 5455b1599f438310146acb3f2190335b852280cb (diff) | |
download | jquery-ui-33a91fb19e19e238a4f841908f2a0c8d56fa2162.tar.gz jquery-ui-33a91fb19e19e238a4f841908f2a0c8d56fa2162.zip |
Spinner demo: Don't use .toggle(fn).
Diffstat (limited to 'demos/spinner')
-rw-r--r-- | demos/spinner/default.html | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/demos/spinner/default.html b/demos/spinner/default.html index 03ae2ad7d..1827724b9 100644 --- a/demos/spinner/default.html +++ b/demos/spinner/default.html @@ -14,16 +14,20 @@ <script> $(function() { var spinner = $( "#spinner" ).spinner(); - - $( "#disable" ).toggle(function() { - spinner.spinner( "disable" ); - }, function() { - spinner.spinner( "enable" ); + + $( "#disable" ).click(function() { + if ( spinner.spinner( "option", "disabled" ) ) { + spinner.spinner( "enable" ); + } else { + spinner.spinner( "disable" ); + } }); - $( "#destroy" ).toggle(function() { - spinner.spinner( "destroy" ); - }, function() { - spinner.spinner(); + $( "#destroy" ).click(function() { + if ( spinner.data( "ui-spinner" ) ) { + spinner.spinner( "destroy" ); + } else { + spinner.spinner(); + } }); $( "#getvalue" ).click(function() { alert( spinner.spinner( "value" ) ); |