0

以下のコードは、ポップアップまたはボタンにマウスオーバーした場合にポップアップが閉じないようにする必要がありますが、リロード時に一度だけ機能し、その後機能しなくなります。

$('.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/

4

1 に答える 1

1

これを試して:

$(".popover2, .popover3-test")
        .mouseleave(function() {
           $('.popover2').delay(1000).fadeOut('1000');
        }
});

http://jsfiddle.net/MnpWV/8/

アップデート:

$(".popover2").hover(function(e) {
    $(this).show()
}, function() {
    $('this').delay(1000).fadeOut('1000');
})

http://jsfiddle.net/MnpWV/16/

イベント.popover3-testをトリガーする を削除します。mouseleave

于 2012-07-03T23:21:59.710 に答える