Jquery

时间:2018-01-11 11:52:14

标签: javascript jquery mouseevent onmouseover

我在使用类名悬停元素时打开/关闭鼠标上/下的弹出窗口。我希望鼠标over / out函数在具有类似类的元素上发生。当在某个时间从一个元素移动到另一个元素时,弹出窗口不会被关闭/打开。

$(document).on('mouseover','.trend-cntnr',function(){
  var thisElem = $(this);
  clearTimeout(PopupDelay);
  PopupDelay=setTimeout(function(){
      setTimeout(function(){
        hide_popup();
        },500)
        thisElem.popover('show');
      },1000);
}).on('mouseout','.trend-cntnr',function(){
  var thisElem = $(this);
  thisElem.popover('hide');
});

HTML

<div class="parent">
    <div class="trend-cntnr">xxx</div>
    <div class="trend-cntnr">xxx</div>
    <div class="trend-cntnr">xxx</div>
    <div class="trend-cntnr">xxx</div>
    <div class="trend-cntnr">xxx</div>
    <div class="trend-cntnr">xxx</div>
 </div>

0 个答案:

没有答案