mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-23 18:40:03 +00: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 () {
|
Button.prototype.toggle = function () {
|
||||||
var $parent = this.$element.closest('[data-toggle="buttons"]')
|
var $parent = this.$element.closest('[data-toggle="buttons"]')
|
||||||
|
var changed = true
|
||||||
|
|
||||||
if ($parent.length) {
|
if ($parent.length) {
|
||||||
var $input = this.$element.find('input')
|
var $input = this.$element.find('input')
|
||||||
.prop('checked', !this.$element.hasClass('active'))
|
if ($input.prop('type') === 'radio') {
|
||||||
.trigger('change')
|
// see if clicking on current one
|
||||||
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
|
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…
x
Reference in New Issue
Block a user