Last active
August 29, 2015 14:19
-
-
Save gdibble/2b11e10d44f46f0fa475 to your computer and use it in GitHub Desktop.
bootstrap popovers stay on hover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global $*/ | |
/* | |
* bootstrap popovers stay on hover [4/11/2014 @gdibble] | |
*/ | |
var originalLeave = $.fn.popover.Constructor.prototype.leave; | |
$.fn.popover.Constructor.prototype.leave = function (obj) { | |
var self, container; | |
if (obj.currentTarget) { | |
self = obj instanceof this.constructor ? obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type); | |
container = $(obj.currentTarget).siblings('.popover'); | |
container.one('mouseenter', function () { | |
clearTimeout(self.timeout); | |
container.one('mouseleave', function () { | |
$.fn.popover.Constructor.prototype.leave.call(self, self); | |
}); | |
}); | |
} else { | |
originalLeave.call(this, obj); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment