【问题标题】:Twitter Bootstrap Popup ignores delayTwitter Bootstrap Popup 忽略延迟
【发布时间】:2012-08-07 09:21:36
【问题描述】:

this question 在 stackoverflow 之后,我创建了一个在悬停时加载的 twitter 引导弹出窗口。但是,没有使用延迟,弹出框立即显示。这是我的代码:

$('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');
});

延迟被忽略。我能做什么?

感谢您的帮助或提示!

【问题讨论】:

  • 你知道延迟does not apply to manual trigger type 吗? doc - 做popover('show') 就像手动。并且将对象作为第二个参数传递肯定不会有任何效果。
  • 不,我以前不知道。但是,如果不使用popover('show'),我该如何显示弹出框?
  • 延迟和弹出窗口有点乱...github issuejsfiddle 会起作用吗?

标签: twitter-bootstrap delay popover


【解决方案1】:

有类似的问题,通过聚焦 obj 解决了它。看起来像这样......

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

如果您想要手动触发,超时会更好..

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

希望是帮助别人...

【讨论】:

    猜你喜欢
    • 2013-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-06
    • 2020-05-12
    • 1970-01-01
    • 1970-01-01
    • 2012-11-02
    相关资源
    最近更新 更多