I have a footer which I want to slide up on .hover. I have it working but it keeps triggering when the cursor is on the footer (the footer keeps going up and down) That’s obviously because of the event I used. This is what I have:
jQuery( function ( $ ) {
var footer = $( ".footer" );
$( ".trigger" ).hover(
function( event ){
event.preventDefault();
if(footer.is( ":visible" )){
footer.slideUp( 800 );
}else{
footer.slideDown( 800 );
}
}
);
});
This script was actually a click event, where this is working fine. But I need an event where the footer moves again when the cursor is not longer on the footer. At least that’s what I guess
Edit: I got it working using .mouseenter and .mouseleave instead
jQuery( function ( $ ) {
$("#footer").mouseenter(function(){
$("div.footer").slideDown(800);
});
$("#footer").mouseleave(function(){
$("div.footer").slideUp(800);
});
});