diff --git a/js/bootstrap-toggle.js b/js/bootstrap-toggle.js index 2481d8c..4ab8be5 100644 --- a/js/bootstrap-toggle.js +++ b/js/bootstrap-toggle.js @@ -203,13 +203,13 @@ }) $(document) - .on('click.bs.toggle', 'div[data-toggle^=toggle]', function(e) { + .on('touchstart.bs.toggle click.bs.toggle', 'div[data-toggle^=toggle]', function(e) { var $checkbox = $(this).find('input[type=checkbox]') $checkbox.bootstrapToggle('toggle') e.preventDefault() e.stopPropagation() }) - .on('click.bs.toggle', 'label[for]', function(e) { + .on('touchstart.bs.toggle click.bs.toggle', 'label[for]', function(e) { var $checkbox = $('#' + $(e.currentTarget).attr('for')); if (!$checkbox[0] || !$checkbox.data('bs.toggle')) return; $checkbox.bootstrapToggle('toggle') diff --git a/js/bootstrap-toggle.min.js b/js/bootstrap-toggle.min.js index 86543c0..d921a75 100644 --- a/js/bootstrap-toggle.min.js +++ b/js/bootstrap-toggle.min.js @@ -1,2 +1,2 @@ -!function(d){"use strict";var i=function(t,e){this.$element=d(t),this.options=d.extend({},this.defaults(),e),this.render()};function f(t){if(0==d(t).length)return!1;var e=t.clone();e.css({visibility:"hidden",width:"",height:"",maxWidth:"",maxHeight:""}),d("body").append(e);var o=e.outerWidth(),s=e.outerHeight();return e.remove(),{width:o,height:s}}i.VERSION="2.2.3",i.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"default",size:"normal",style:"",width:null,height:null},i.prototype.defaults=function(){return{on:this.$element.attr("data-on")||i.DEFAULTS.on,off:this.$element.attr("data-off")||i.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||i.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||i.DEFAULTS.offstyle,size:this.$element.attr("data-size")||i.DEFAULTS.size,style:this.$element.attr("data-style")||i.DEFAULTS.style,width:this.$element.attr("data-width")||i.DEFAULTS.width,height:this.$element.attr("data-height")||i.DEFAULTS.height}},i.prototype.render=function(){this._onstyle="btn-"+this.options.onstyle,this._offstyle="btn-"+this.options.offstyle;var t="large"===this.options.size?"btn-lg":"small"===this.options.size?"btn-sm":"mini"===this.options.size?"btn-xs":"",e=d('