aboutsummaryrefslogtreecommitdiff
path: root/dist/js/bootstrap.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2013-11-30 00:26:53 -0800
committerMark Otto <[email protected]>2013-11-30 00:26:53 -0800
commitbb4a39d51cd644b212323a7e36f0b5af2682d0ca (patch)
tree60ae6687f516cea501f32f5623a5c0aacb950772 /dist/js/bootstrap.js
parent96109d3138fd6f5b67fb1108754e81c077630b36 (diff)
parente6eb798178529cf58fab3f33446c0170bae7bdea (diff)
downloadbootstrap-bb4a39d51cd644b212323a7e36f0b5af2682d0ca.tar.xz
bootstrap-bb4a39d51cd644b212323a7e36f0b5af2682d0ca.zip
Merge branch 'master' into pr/11388
Conflicts: dist/css/bootstrap.min.css
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r--dist/js/bootstrap.js30
1 files changed, 18 insertions, 12 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js
index 1c638ab44..b7313f403 100644
--- a/dist/js/bootstrap.js
+++ b/dist/js/bootstrap.js
@@ -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')
}
@@ -345,7 +351,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
if (pos > (this.$items.length - 1) || pos < 0) return
- if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
+ if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
@@ -397,7 +403,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
if (this.$indicators.length) {
this.$indicators.find('.active').removeClass('active')
- this.$element.one('slid', function () {
+ this.$element.one('slid.bs.carousel', function () {
var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
$nextIndicator && $nextIndicator.addClass('active')
})
@@ -415,7 +421,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
- setTimeout(function () { that.$element.trigger('slid') }, 0)
+ setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
})
.emulateTransitionEnd(600)
} else {
@@ -424,7 +430,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
- this.$element.trigger('slid')
+ this.$element.trigger('slid.bs.carousel')
}
isCycling && this.cycle()
@@ -715,7 +721,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
- // if mobile we we use a backdrop because click events don't delegate
+ // if mobile we use a backdrop because click events don't delegate
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
}
@@ -797,9 +803,9 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
- var data = $this.data('dropdown')
+ var data = $this.data('bs.dropdown')
- if (!data) $this.data('dropdown', (data = new Dropdown(this)))
+ if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
@@ -1694,7 +1700,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
.addClass('active')
}
- active.trigger('activate')
+ active.trigger('activate.bs.scrollspy')
}