Jquery 推特引导弹出窗口消失得太快了

Jquery 推特引导弹出窗口消失得太快了,jquery,ajax,twitter-bootstrap,opencart,Jquery,Ajax,Twitter Bootstrap,Opencart,我正在使用Twitter引导弹出窗口创建一个“快速查看”效果,当人们将鼠标移到某个项目上时,可以显示更多信息。popover的内容来自一个Ajax调用 下面的代码在第一次悬停时运行良好;但是,在随后的鼠标移动中,弹出框消失得太快,不允许您查看内容 有人能找出问题所在吗 $(document).ready(function(){ //Quick view boxes var overPopup = false; $("a[rel=popover]", '.favorite

我正在使用Twitter引导弹出窗口创建一个“快速查看”效果,当人们将鼠标移到某个项目上时,可以显示更多信息。popover的内容来自一个Ajax调用

下面的代码在第一次悬停时运行良好;但是,在随后的鼠标移动中,弹出框消失得太快,不允许您查看内容

有人能找出问题所在吗

$(document).ready(function(){
    //Quick view boxes
    var overPopup = false;

    $("a[rel=popover]", '.favorites').popover({
        trigger: 'manual',
        placement: 'bottom',
        html: true,
        content: function(){
            var div_id =  "div-id-" + $.now();
            return details_in_popup(div_id, $(this).data('product-id'));
        }

    }).mouseover(function (e) {
        // when hovering over an element which has a popover, hide
        // them all except the current one being hovered upon
        $('[rel=popover]').not('#' + $(this).data('unique')).popover('hide');
        var $popover = $(this);
        $popover.popover('show');

        $popover.data('popover').tip().mouseenter(function () {
            overPopup = true;
        }).mouseleave(function () {
            overPopup = false;
            $popover.popover('hide');
        });

    }).mouseout(function (e) {
        // on mouse out of button, close the related popover
        // in 200 milliseconds if you're not hovering over the popover
        var $popover = $(this);
        setTimeout(function () {
            if (!overPopup) {
                 $popover.popover('hide');
            }
        }, 200);
    });
});

function details_in_popup(div_id, product_id){
    $.ajax({
        url: 'index.php?route=product/product/get_product_ajax',
        type: 'post',
        data: 'product_id=' + product_id,
        dataType: 'json',
        success: function(json){
            if (json['success']) {
                $('#' + div_id).html(json['success']);
            }

        }
    });
    return '<div id="'+ div_id +'">Loading...</div>';
}
$(文档).ready(函数(){
//快速查看框
var overPopup=假;
$(“a[rel=popover],'.favorites').popover({
触发器:“手动”,
位置:'底部',
是的,
内容:函数(){
var div_id=“div id-”+$.now();
返回弹出窗口中的详细信息(div_id,$(this).data('product-id');
}
}).鼠标悬停(功能(e){
//将鼠标悬停在具有popover的元素上时,隐藏
//除了当前悬停在上面的那一个之外,它们都是
$('[rel=popover]')。不是('#'+$(this.data('unique'))。popover('hide');
var$popover=$(此);
$popover.popover('show');
$popover.data('popover').tip().mouseenter(函数(){
人口过剩=真;
}).mouseleave(函数(){
人口过剩=错误;
$popover.popover('hide');
});
}).mouseout(功能(e){
//在鼠标离开按钮时,关闭相关的弹出窗口
//如果你没有在popover上悬停,200毫秒后
var$popover=$(此);
setTimeout(函数(){
如果(!人口过剩){
$popover.popover('hide');
}
}, 200);
});
});
弹出窗口中的功能详细信息(部门id、产品id){
$.ajax({
url:'index.php?route=product/product/get\u product\u ajax',
键入:“post”,
数据:“产品标识=”+产品标识,
数据类型:“json”,
成功:函数(json){
if(json['success']){
$('#'+div_id).html(json['success']);
}
}
});
返回“正在加载…”;
}
.not(“#”+$(this.data('unique'))
更改为
。not(“[data unique=”+$(this.data('unique')+”])
修复了问题


我不太清楚为什么会出现这个问题,但我知道如果从等式中删除“bootstrap transition.js”,问题也会消失。

非常感谢,这解决了这个问题。也可以只调用一次ajax吗?现在,每次我将鼠标移到某个项目上时都会发出ajax调用。可以调整js吗?如果div已经有了内容,就不要再尝试填充它了。@farjam是的,可以。我建议你为此再发一个问题。我现在正在打电话,但我认为如果你给你的问题加上“jquery”标签,你应该能够很快得到答案。谢谢,我还没有找到我另一个问题的答案。你介意看一看这本书吗?如果你对此有任何意见,请告诉我。谢谢你的帮助。