user2091820
user2091820

Reputation: 1

[body onload]FadeIn a div after a Set of time?

I've been looking about how to fade a div after a set of time with jQuery.

I tried

$(test).fadeIn("slow").delay(2000)

But I think I am missing something on the code?

Upvotes: 0

Views: 233

Answers (4)

MIIB
MIIB

Reputation: 1849

setTimeout(myFunc, 2000);
function myFunc(){
$(test).fadeIn('slow');
}

Upvotes: 0

Green Black
Green Black

Reputation: 5084

turn it around:

<div id="test" style="display:none">Hello!</div>

<script type="text/javascript">
$(function(){

   $("#test").delay(2000).fadeIn("slow")
});
</script>

Upvotes: 0

bizzehdee
bizzehdee

Reputation: 21023

you need to delay first, and then attemot the fade in

$(test).delay(2000).fadeIn("slow");

Upvotes: 0

Joe
Joe

Reputation: 6416

Try this:

setTimeout(function(){$('#test').fadeIn('slow');}, 2000);

Upvotes: 3

Related Questions