开发者

How can I show a div with Jquery hover and then hide?

开发者 https://www.devze.com 2023-01-02 20:37 出处:网络
I am trying to show a div when the cursor hovers over and image and hide the div when It is not hovered over the image how is this done?? So far I have a basic show:

I am trying to show a div when the cursor hovers over and image and hide the div when It is not hovered over the image how is this done?? So far I have a basic show:

  <script type="t开发者_运维问答ext/javascript">

  $(document).ready(function(){

  $(".plans").hover(function()
  {
    $("#planssubnav").show("slow");
  }

);

});

  </script>


Try this:

 $(document).ready(function(){
  $(".plans").hover(function() {
    $("#planssubnav").show("slow");
  }, function(){
    $("#planssubnav").hide("slow");
  });
 });

The hover method needs two functions (second one is optional though), first one is executed when mouse enters the wrapped set and the second one when mouse leaves it, so you were missing the second one to hide it.

0

精彩评论

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

关注公众号