Search code examples
jqueryhoverslidetoggle

.slideToggle hover on div jquery


I want to be able to slideToggle a div on hover, but it is not working.. Here is the code:

<div class='slide-header'>
        header....
</div>

<div class='slide-content'>
       Content..................
</div>

<script>
$(".slide-header").hover(function () {
    $(".slide-content").slideToggle("slow");
});
</script>

<style><!-- initially, I don't want to display .slide-content -->
    .slide-content { display:none; }
</style>

How can I .slideToggle on hover? Thanks!


Solution

  • Try this

    $(".slide-header").hover(function () {
        $(".slide-content").stop().slideDown("slow");
    }, function(){
        $(".slide-content").stop().slideUp("slow");
    });