!function ($) { "use strict"; $.fn.switch = function (method) { var methods = { init:function () { this.each(function () { var $element = $(this) , $div , $switchLeft , $switchRight , $label , myClasses = "" , classes = $element.attr('class') , color , moving; $.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) { if (classes.indexOf(el) >= 0) myClasses = el; }); if ($element.data('on') !== undefined) color = "switch-" + $element.data('on'); $switchLeft = $('') .addClass("switch-left") .addClass(myClasses) .addClass(color) .text("ON"); if ($element.data('off') !== undefined) color = "switch-" + $element.data('off'); $switchRight = $('') .addClass("switch-right") .addClass(myClasses) .addClass(color) .text("OFF"); $label = $('