0

I've got this code which sets the .css value of a div

$("#1").mouseover(function () {
   $("#naam").css('visibility', 'visible');
});

I want an interval of a X amount of time on it.

2
  • 3
    An interval for doing what? I guess you mean a delay Commented Feb 28, 2014 at 13:52
  • Yes a delay sorry =(( Commented Feb 28, 2014 at 13:55

3 Answers 3

4

You could use delay():

$("#1").mouseover(function () {
    $("#naam").finish().delay(2000).show(0);
});

Or use setTimeout()

As not stipulated in DOC but AFAIK, .finish() (jq 1.9+) clears any previous running delay applied to element.

Sign up to request clarification or add additional context in comments.

Comments

2

I guess, what you want is .delay() :

$( "#1" ).mouseover(function() {
    $( "#naam" ).delay( 800 ).show(0);
});

The document is here: https://api.jquery.com/delay/

1 Comment

Indeed, you need .show(0) or no animation will be put in queue
1
$("#1").mouseover(
    setTimeout(function () {
        function() { 
            $("#naam").css('visibility','visible');
        }
    },30000);
);

1 Comment

You need to use setTimeout not setInterval . It execute on every 30 sec interval

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.