Skip to content

Commit

Permalink
Added touch support
Browse files Browse the repository at this point in the history
  • Loading branch information
landy2005 committed Mar 7, 2019
1 parent 46ca860 commit 02ec51c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions js/bootstrap-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion js/bootstrap-toggle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/bootstrap-toggle.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 02ec51c

Please sign in to comment.