简体   繁体   English

jQuery不断触发悬停

[英]JQuery constantly fire hover

I want the hover function to fire constantly while the mouse is over the div currently I am using this but it fires only once. 我希望鼠标当前位于div上方时,悬停功能能够不断触发,但我只能触发一次。 It monitors where the mouse is and says whether it is in section 1 or 2. 它监视鼠标在哪里,并说出它在第1节还是第2节中。

  $(".rating-image").mouseover(function(e){
        var offset = $(this).offset();
    where=(e.clientX - offset.left);
    if(where<=28){alert('1');}
    if(where>28){alert('2');}
  });

使用mousemove可以解决问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM