Twitter Bootstrap Popup ignores delay

*爱你&永不变心* 提交于 2020-01-13 09:04:01

问题


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?

Thanks for your help or hints!


回答1:


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...



来源:https://stackoverflow.com/questions/11842851/twitter-bootstrap-popup-ignores-delay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!