开发者

jQuery hover issue on mouseout

开发者 https://www.devze.com 2023-04-07 17:58 出处:网络
I am using the jQuery variable \"mouseover\" and \"mouseout\" to show a DIV element when hovering over another.

I am using the jQuery variable "mouseover" and "mouseout" to show a DIV element when hovering over another.

http://74.54.17.66/~adbuynet/case-studies/ - If you hover over "Call to Action" in the top right, you see a dropdown.

The problem is, that when mousing over the dropdown itself, the dropdown starts acting funky and does not stay open. My jQuery code is:

    $("#call-to-action").mouseover(function开发者_高级运维(e) {     
    $("#call-to-action-dropdown").show("slide", { direction: "up" }, 200);  
    e.stopPropagation();
  });
  $("#call-to-action").mouseout(function(e) {     
    $("#call-to-action-dropdown").hide("slide", { direction: "up" }, 200);  
  });
}); 

What mistake have I made please?


Use mouseenter and mouseleave instead of mouseover and mouseout. See http://api.jquery.com/mouseenter/.

(You’ll almost never want to use mouseover/mouseout, and when you do, you’ll know it.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号