mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
<3 @asselin for figuring out this combo of 2 patches for #9920; re-grunt
This commit is contained in:
parent
5d6e9212a6
commit
7a3f41b11b
14
dist/js/bootstrap.js
vendored
14
dist/js/bootstrap.js
vendored
@ -220,15 +220,21 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
|
||||
|
||||
Button.prototype.toggle = function () {
|
||||
var $parent = this.$element.closest('[data-toggle="buttons"]')
|
||||
var changed = true
|
||||
|
||||
if ($parent.length) {
|
||||
var $input = this.$element.find('input')
|
||||
.prop('checked', !this.$element.hasClass('active'))
|
||||
.trigger('change')
|
||||
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
|
||||
if ($input.prop('type') === 'radio') {
|
||||
// see if clicking on current one
|
||||
if ($input.prop('checked') && this.$element.hasClass('active'))
|
||||
changed = false
|
||||
else
|
||||
$parent.find('.active').removeClass('active')
|
||||
}
|
||||
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
|
||||
}
|
||||
|
||||
this.$element.toggleClass('active')
|
||||
if (changed) this.$element.toggleClass('active')
|
||||
}
|
||||
|
||||
|
||||
|
2
dist/js/bootstrap.min.js
vendored
2
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user