So I am trying to achieve a popup situation, where the user will hover over one element, when the user hovers over this element, jQuery adds a class to another sibling element which makes it visible. When the user hovers out I'd like to add a delay of like 5 seconds before the class is removed again, but my attempts to do this have not worked out thus far, can anybody give me a pointer on what method I can use?
Here is the code I'm using at the moment:
$('.spaceship-container').hover(
function(){
$('.take-me-to-your-newsletter').addClass('show')
},
function(){
setTimeout(3000);
$('.take-me-to-your-newsletter').removeClass('show')
}
);