From 24b7ff1f177fae920750de1ae0272164cd6a1094 Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 21 May 2012 10:11:01 -0400 Subject: Widget demo: Don't use .toggle(fn). --- demos/widget/default.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'demos') diff --git a/demos/widget/default.html b/demos/widget/default.html index ece81218a..f39825034 100644 --- a/demos/widget/default.html +++ b/demos/widget/default.html @@ -139,11 +139,14 @@ }); // click to toggle enabled/disabled - $( "#disable" ).toggle(function() { + $( "#disable" ).click(function() { // use the custom selector created for each widget to find all instances - $( ":custom-colorize" ).colorize( "disable" ); - }, function() { - $( ":custom-colorize" ).colorize( "enable" ); + // all instances are toggled together, so we can check the state from the first + if ( $( ":custom-colorize" ).colorize( "option", "disabled" ) ) { + $( ":custom-colorize" ).colorize( "enable" ); + } else { + $( ":custom-colorize" ).colorize( "disable" ); + } }); // click to set options after initalization -- cgit v1.2.3