diff options
author | Gleb Mazovetskiy <glex.spb@gmail.com> | 2013-11-14 06:38:32 +0400 |
---|---|---|
committer | Gleb Mazovetskiy <glex.spb@gmail.com> | 2013-11-14 21:28:03 +0400 |
commit | 263dc713ff89de6f5784e8cfd0d22aa2bc2aaef0 (patch) | |
tree | 1de669ed58bb95ef951925529698cb9946db0e93 /vendor/assets/javascripts/bootstrap | |
parent | efab96f854dc8b08d46297b9af313fbe815124ac (diff) |
rake convert
Diffstat (limited to 'vendor/assets/javascripts/bootstrap')
-rw-r--r-- | vendor/assets/javascripts/bootstrap/button.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/vendor/assets/javascripts/bootstrap/button.js b/vendor/assets/javascripts/bootstrap/button.js index 0145689d..3c161350 100644 --- a/vendor/assets/javascripts/bootstrap/button.js +++ b/vendor/assets/javascripts/bootstrap/button.js @@ -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') } |