0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

<3 @asselin for figuring out this combo of 2 patches for #9920; re-grunt

This commit is contained in:
Chris Rebert 2013-11-05 22:20:29 -08:00
parent 5d6e9212a6
commit 7a3f41b11b
3 changed files with 13 additions and 7 deletions

14
dist/js/bootstrap.js vendored
View File

@ -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')
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long