Twitter Bootstrap Popup忽略了延迟 [英] Twitter Bootstrap Popup ignores delay

查看:90
本文介绍了Twitter Bootstrap Popup忽略了延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上的这个问题之后,我创建了一个Twitter悬停时加载的bootstrap popover.但是,不使用延迟,弹出窗口会立即显示.这是我的代码:

Following this question here on stackoverflow, I created a twitter bootstrap popover that loads on hover. However, the delay is not used, the popover just shows immediately. Here's my code:

$('body').delegate('.withajaxpopover', 'hover', function(event) {
   if (event.type === 'mouseenter') {
      var el=$(this);
      $.get(el.attr('data-load'), function(d) {
      el.popover({delay: { 
                     show: 750, 
                     hide: 100
                  },
                  title: "MyTitle", 
                  content: d}).popover('show', 
                                       {delay: { show: 750, hide: 100 }});
                    });
   } else {
                    $(this).popover('hide');
   }
});
$('body').delegate('.withajaxpopover', 'click', function(event) {
   $(this).popover('hide');
});

延迟被忽略.我该怎么办?

The delay is just ignored. What can I do?

感谢您的帮助或提示!

推荐答案

有一个类似的问题,通过将obj集中起来解决了.看起来像这样...

Had a similar issue, solved it by focusing the obj. Would look something like this...

$('#yourobj').popover({
    trigger: 'focus',
    delay: 1000
 }).focus();

如果您要手动触发,则超时甚至更好.

even better with a timeout, if you want a manual trigger..

setTimeout(function() {
  $('#yourobj').popover('show');
}, 500);

希望对别人有帮助...

Hope is helps someone else...

这篇关于Twitter Bootstrap Popup忽略了延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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