Skip to content

Instantly share code, notes, and snippets.

@gdibble
Last active August 29, 2015 14:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdibble/2b11e10d44f46f0fa475 to your computer and use it in GitHub Desktop.
Save gdibble/2b11e10d44f46f0fa475 to your computer and use it in GitHub Desktop.
bootstrap popovers stay on hover
/*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