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!
Try this
$(".slide-header").hover(function () {
$(".slide-content").stop().slideDown("slow");
}, function(){
$(".slide-content").stop().slideUp("slow");
});
Wrap it in a document ready function:
$(function(){
$(".slide-header").hover(function () {
$(".slide-content").slideToggle("slow");
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With