refactor: bootstrap-toggle 移动设备支持代码优化

This commit is contained in:
Argo Zhang 2019-10-07 10:58:08 +08:00
parent 8b5b79908c
commit 1389f386d4
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 4 additions and 6 deletions

View File

@ -517,6 +517,10 @@
var defaultVal = this.$element.attr('data-default-val') || '';
if (defaultVal === '') this.$element.prop('checked', true);
oldFunc.call(this);
this.$toggle.on('touchend', function (e) {
$(this).trigger('click.bs.toggle');
e.preventDefault();
});
}
}
@ -574,11 +578,5 @@
$('.date').lgbDatePicker().on('show hide', function (e) {
e.stopPropagation();
});
// 移动设备支持 bootstrap-toggle 扩展
$('[data-toggle="toggle"]').on('touchend', function (e) {
$(this).trigger('click.bs.toggle');
e.preventDefault();
});
});
})(jQuery);