Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get my div to fade out with jQuery on page load?

I'm brand new to jQuery (and javascript in general). I've been meaning to use it/learn it for some time, and nows the time.

So I'm going to use jQuery on this page to fade out the "under construction" warning at the top of the page on load. But I'm unfamiliar with any of the functions or selectors to use.

I found this basic article at jQuery which has a demo that seems to work perfect for what I'm doing, only it's set up to fade out on click.

What do I need to change to get it to fade out after a few seconds once the page has loaded, and can you point me where to look to find out more about those type of functions (specifically on jQuery's site, if you're familiar). And please don't say, "In the documentation." I'm a noob but not a dummy, thanks. I'm just trying to learn more about that particular area of the syntax responsible for functions for now (if that's what they're called).

like image 572
Joel Glovier Avatar asked Nov 30 '22 10:11

Joel Glovier


1 Answers

New to jQuery 1.4 is the delay method. Using it for this purpose:

$("#myDiv").delay(3000).fadeOut("slow");
like image 111
cnanney Avatar answered Dec 05 '22 17:12

cnanney