aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorIvan Khalopik <[email protected]>2013-06-10 10:31:51 +0300
committerIvan Khalopik <[email protected]>2013-06-10 10:31:51 +0300
commite138b0df3a1bcd536cc312d7c4714ff5bc9acd2b (patch)
tree2d6f41184d19466d6f9fa016ba521260413435cb /js
parent3285f4c3062f4a56eaed2461a3128a2e6a3ba9cc (diff)
parentd74a9634b0cb21a712f5e805c7a21132dc9bee5e (diff)
downloadbootstrap-e138b0df3a1bcd536cc312d7c4714ff5bc9acd2b.tar.xz
bootstrap-e138b0df3a1bcd536cc312d7c4714ff5bc9acd2b.zip
Merge remote-tracking branch 'bootstrap/3.0.0-wip' into 3.0.0-wip
Diffstat (limited to 'js')
-rw-r--r--js/carousel.js2
-rw-r--r--js/modal.js14
-rw-r--r--js/tooltip.js19
3 files changed, 19 insertions, 16 deletions
diff --git a/js/carousel.js b/js/carousel.js
index 0da8e41ca..547007d2d 100644
--- a/js/carousel.js
+++ b/js/carousel.js
@@ -194,7 +194,7 @@
$target.carousel(options)
if (slideIndex = $this.attr('data-slide-to')) {
- $target.data('bs-carousel').pause().to(slideIndex).cycle()
+ $target.data('bs.carousel').pause().to(slideIndex).cycle()
}
e.preventDefault()
diff --git a/js/modal.js b/js/modal.js
index 07b508124..81766b323 100644
--- a/js/modal.js
+++ b/js/modal.js
@@ -106,18 +106,18 @@
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
- .on('focusin.bs.modal', function (e) {
- if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
- this.$element.focus()
- }
- }, this)
+ .on('focusin.bs.modal', $.proxy(function (e) {
+ if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
+ this.$element.focus()
+ }
+ }, this))
}
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
- this.$element.on('keyup.dismiss.bs.modal', function ( e ) {
+ this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
- }, this)
+ }, this))
} else if (!this.isShown) {
this.$element.off('keyup.dismiss.bs.modal')
}
diff --git a/js/tooltip.js b/js/tooltip.js
index 80bdf7266..d95624bdc 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -91,7 +91,7 @@
return options
}
- Tooltip.prototype.enter = function (e) {
+ Tooltip.prototype.enter = function (obj) {
var defaults = this.getDefaults()
var options = {}
@@ -99,26 +99,29 @@
if (defaults[key] != value) options[key] = value
})
- var self = $(e.currentTarget)[this.type](options).data('bs.' + this.type)
+ var self = obj instanceof this.constructor ?
+ obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
if (!self.options.delay || !self.options.delay.show) return self.show()
clearTimeout(this.timeout)
self.hoverState = 'in'
- this.timeout = setTimeout(function() {
+ this.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
- Tooltip.prototype.leave = function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data('bs.' + this.type)
+ Tooltip.prototype.leave = function (obj) {
+ var self = obj instanceof this.constructor ?
+ obj : $(obj.currentTarget)[this.type](this._options).data('bs.' + this.type)
+
+ clearTimeout(this.timeout)
- if (this.timeout) clearTimeout(this.timeout)
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.hoverState = 'out'
- this.timeout = setTimeout(function() {
+ this.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
@@ -315,7 +318,7 @@
Tooltip.prototype.toggle = function (e) {
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
- self.tip().hasClass('in') ? self.hide() : self.show()
+ self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
Tooltip.prototype.destroy = function () {