Expected) after the argument list

This is driving me crazy, my google searches point to speech expression issues, but I can't figure out how it goes with my code below, especially after I've alternated between single and double quotes, but still not happy :

$( ".block-nav .c-4" ).hover(
    setTimeout(function(){
        $(".block-nav .c-4 .white-overlay").css("display", "none");
    },300);
);

      

Any pointers appreciated ...

+3


source to share


2 answers


you need to use a wrapper function() {}

:



$( ".block-nav .c-4" ).hover( function() {
    setTimeout(function(){
        $(".block-nav .c-4 .white-overlay").css("display", "none");
    },300); }
);

      

+10


source


You seem to want a delay 300ms

after the user hovers over the element and you want to trigger this function. If it does, try this (wrap the call setTimeout

in a function):



$( ".block-nav .c-4" ).on('mouseenter', function () {
    setTimeout(function(){
        $(".block-nav .c-4 .white-overlay").css("display", "none");
    },300);
});

      

0


source







All Articles