0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-17 09:52:29 +01:00

fix ghetto ass timeout shit

This commit is contained in:
fat 2012-12-19 21:55:23 -08:00
parent 5bd8cdca91
commit dc4e80a655
4 changed files with 43 additions and 7 deletions

View File

@ -172,6 +172,7 @@
, listen: function () {
this.$element
.on('focus', $.proxy(this.focus, this))
.on('blur', $.proxy(this.blur, this))
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))
@ -183,6 +184,7 @@
this.$menu
.on('click', $.proxy(this.click, this))
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
.on('mouseleave', 'li', $.proxy(this.mouseleave, this))
}
, eventSupported: function(eventName) {
@ -256,9 +258,13 @@
e.preventDefault()
}
, focus: function (e) {
this.focused = true
}
, blur: function (e) {
var that = this
setTimeout(function () { that.hide() }, 150)
this.focused = false
if (!this.mousedover && this.shown) this.hide()
}
, click: function (e) {
@ -268,10 +274,16 @@
}
, mouseenter: function (e) {
this.mousedover = true
this.$menu.find('.active').removeClass('active')
$(e.currentTarget).addClass('active')
}
, mouseleave: function (e) {
this.mousedover = false
if (!this.focused && this.shown) this.hide()
}
}

View File

@ -1889,6 +1889,7 @@
, listen: function () {
this.$element
.on('focus', $.proxy(this.focus, this))
.on('blur', $.proxy(this.blur, this))
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))
@ -1900,6 +1901,7 @@
this.$menu
.on('click', $.proxy(this.click, this))
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
.on('mouseleave', 'li', $.proxy(this.mouseleave, this))
}
, eventSupported: function(eventName) {
@ -1973,9 +1975,13 @@
e.preventDefault()
}
, focus: function (e) {
this.focused = true
}
, blur: function (e) {
var that = this
setTimeout(function () { that.hide() }, 150)
this.focused = false
if (!this.mousedover && this.shown) this.hide()
}
, click: function (e) {
@ -1985,10 +1991,16 @@
}
, mouseenter: function (e) {
this.mousedover = true
this.$menu.find('.active').removeClass('active')
$(e.currentTarget).addClass('active')
}
, mouseleave: function (e) {
this.mousedover = false
if (!this.focused && this.shown) this.hide()
}
}

File diff suppressed because one or more lines are too long

View File

@ -172,6 +172,7 @@
, listen: function () {
this.$element
.on('focus', $.proxy(this.focus, this))
.on('blur', $.proxy(this.blur, this))
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))
@ -183,6 +184,7 @@
this.$menu
.on('click', $.proxy(this.click, this))
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
.on('mouseleave', 'li', $.proxy(this.mouseleave, this))
}
, eventSupported: function(eventName) {
@ -256,9 +258,13 @@
e.preventDefault()
}
, focus: function (e) {
this.focused = true
}
, blur: function (e) {
var that = this
setTimeout(function () { that.hide() }, 150)
this.focused = false
if (!this.mousedover && this.shown) this.hide()
}
, click: function (e) {
@ -268,10 +274,16 @@
}
, mouseenter: function (e) {
this.mousedover = true
this.$menu.find('.active').removeClass('active')
$(e.currentTarget).addClass('active')
}
, mouseleave: function (e) {
this.mousedover = false
if (!this.focused && this.shown) this.hide()
}
}