开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜