diff options
| author | Mark Otto <[email protected]> | 2013-11-30 00:55:00 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-11-30 00:55:00 -0800 |
| commit | 080aa7f5c8557b232005cb947df51968d4629656 (patch) | |
| tree | e546cc3ec229d201751e426da36a1b2a586ee428 /js/button.js | |
| parent | 441f9d67179f766377eed4b0cedc5dc6eec290e4 (diff) | |
| parent | 819e920d1646f7e9fec8d3dd6ba10dcbd2fa1599 (diff) | |
| download | bootstrap-080aa7f5c8557b232005cb947df51968d4629656.tar.xz bootstrap-080aa7f5c8557b232005cb947df51968d4629656.zip | |
Merge branch 'master' into pr/11299
Conflicts:
dist/css/bootstrap.min.css
docs-assets/js/raw-files.js
Diffstat (limited to 'js/button.js')
| -rw-r--r-- | js/button.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/js/button.js b/js/button.js index 44c101a2a..3c1613506 100644 --- a/js/button.js +++ b/js/button.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: button.js v3.0.0 + * Bootstrap: button.js v3.0.2 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -54,15 +54,21 @@ 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') } @@ -106,4 +112,4 @@ e.preventDefault() }) -}(window.jQuery); +}(jQuery); |
