|
@@ -23,7 +23,8 @@
|
|
, color
|
|
, color
|
|
, moving
|
|
, moving
|
|
, onLabel = "ON"
|
|
, onLabel = "ON"
|
|
- , offLabel = "OFF";
|
|
|
|
|
|
+ , offLabel = "OFF"
|
|
|
|
+ , icon = false;
|
|
|
|
|
|
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
|
|
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
|
|
if (classes.indexOf(el) >= 0)
|
|
if (classes.indexOf(el) >= 0)
|
|
@@ -41,6 +42,9 @@
|
|
if ($element.data('off-label') !== undefined)
|
|
if ($element.data('off-label') !== undefined)
|
|
offLabel = $element.data('off-label');
|
|
offLabel = $element.data('off-label');
|
|
|
|
|
|
|
|
+ if ($element.data('icon') !== undefined)
|
|
|
|
+ icon = $element.data('icon');
|
|
|
|
+
|
|
$switchLeft = $('<span>')
|
|
$switchLeft = $('<span>')
|
|
.addClass("switch-left")
|
|
.addClass("switch-left")
|
|
.addClass(myClasses)
|
|
.addClass(myClasses)
|
|
@@ -62,6 +66,10 @@
|
|
.addClass(myClasses)
|
|
.addClass(myClasses)
|
|
.attr('for', $element.find('input').attr('id'));
|
|
.attr('for', $element.find('input').attr('id'));
|
|
|
|
|
|
|
|
+ if (icon) {
|
|
|
|
+ $label.html('<i class="icon icon-'+icon+'"></i>');
|
|
|
|
+ }
|
|
|
|
+
|
|
$div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false);
|
|
$div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false);
|
|
|
|
|
|
if ($element.data('animated') !== false)
|
|
if ($element.data('animated') !== false)
|
|
@@ -103,7 +111,11 @@
|
|
var $element = $(this).parent();
|
|
var $element = $(this).parent();
|
|
|
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
- e.stopImmediatePropagation();
|
|
|
|
|
|
+ // don't stop propagation of the
|
|
|
|
+ // change event, there's no need to do so
|
|
|
|
+ // and we don't want to break other modules
|
|
|
|
+ // that might depend on this event.
|
|
|
|
+ // e.stopImmediatePropagation();
|
|
|
|
|
|
$element.css('left', '');
|
|
$element.css('left', '');
|
|
|
|
|