This toggle plugin was developed for sites that already run jQuery UI and don't want the extra bloat of another library. It draws upon the theme slider for the look and feel, and can be applied to <select>
elements with two child options.
$(".selector").toggleSwitch({ highlight: true, // default width: 25, // default change: function(e) { // default null }, stop: function(e,val) { // default null } });
The value of the underlying <select>
is updated, so this plugin is form friendly.
Known Issue: There is an IE specific animation bug in jQuery core that was introduced around the 1.6 - 1.7 mark. I wanted to delay the release of this until it was rectified, but it doesn't look like happening any time soon.