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.
精彩评论