引导程序的弹出延迟不起作用 [英] Popover delay at bootstrap doesnt work

查看:100
本文介绍了引导程序的弹出延迟不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望过一会儿才能隐藏弹出窗口.我对此进行了编码-> CODE 工作..

JS

I want the popover to hide after a while. I coded this -> CODE work..

JS

$('#qoo').popover({
    placement : 'left',
    html : true,
    delay: { 
             show: 500, 
             hide: 100
    },
    content: function() {
    return $('#content-wrapper1').html();
}                 

});

HTML

<div class="span1 offset1">
     <a href="#" id="qoo" rel="popover" data-original-title="TITLEEEE" class="circle"> textttt</a>
     <div id="content-wrapper1" class="content-wrapper"> texttttttat</div> 
</div>

但这是行不通的.

推荐答案

延迟显示/隐藏不会自动显示/隐藏弹出窗口,它在之前定义了延迟!另外,延迟不适用于手动触发器类型,因此您必须具有触发器,例如hover.延误工作.

Delay show / hide does not automatically show / hide the popover, it defines the delays before doing so! Also, delay does not apply to manual trigger type, so you must have a trigger, like hover. to get the delays to work.

$('#qoo').popover({
    placement : 'right',
    html : true,
    trigger : 'hover', //<--- you need a trigger other than manual
    delay: { 
       show: "500", 
       hide: "100"
    },
    content: function() {
        return $('#content-wrapper1').html();
    }
});

但是,要实现针对弹出窗口的自动隐藏,您可以通过挂钩shown.bs.popover事件来执行以下操作:

However, to achieve automatically hide for the popover, you can do the following by hooking into the shown.bs.popover event :

$('#qoo').on('shown.bs.popover', function() {
    setTimeout(function() {
        $('#qoo').popover('hide');
    }, 1000);
});

上面的内容在1000毫秒(1秒)后隐藏了弹出窗口.

The above hides the popover after 1000 ms, 1 second.

这篇关于引导程序的弹出延迟不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆