egr103
egr103

Reputation: 4018

Expected ) after argument list

This is driving me nuts, my Google searches point to speechmark problems but I cannot fathom how this is the case with my code below, especially after I have alternated between single and double quote marks but still no joy:

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

Any pointers appreciated...

Upvotes: 2

Views: 134

Answers (2)

Alex McMillan
Alex McMillan

Reputation: 17962

It appears you want a 300ms delay after the user hovers an element, then you want to run that function. If that's the case, try this (wrapping your setTimeout call in a function):

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

Upvotes: 1

Bruno
Bruno

Reputation: 4665

you have to use a function() {} wrapper :

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

Upvotes: 9

Related Questions