下面的代码应该可以防止弹出窗口关闭,如果您将鼠标悬停在该按钮上或该按钮上,但是它只能在重新加载时才起作用,然后停止工作。代码只执行一次,但应该继续
$('.popover3-test').popover({
placement:'bottom',
template: $('.popover2'),
trigger: 'manual',
}).mouseenter(function(e) {
$(this).popover('show');
var t = null;
$(".popover2, .popover3-test")
.mouseleave(function() {
t = setTimeout(function() {
$('.popover2').hide();
}, 1000); // Or however many milliseconds
})
.mouseenter(function() {
if(t !== null)
clearTimeout(t);
});
});
演示:http://jsfiddle.net/MnpWV/1/
请更改您的问题 – Ibu
它工作一次,然后停止工作,我希望它继续工作。 – dezman
@watson删除'clearTimeout'然后它将工作。 http://jsfiddle.net/MnpWV/2/ – undefined