Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-09-2010, 05:06 PM   PM User | #1
yaksho
New Coder

 
Join Date: Oct 2009
Location: Nepal
Posts: 48
Thanks: 2
Thanked 0 Times in 0 Posts
yaksho is an unknown quantity at this point
Fade in on page loads

Hey,

I just want my DIV and it's content fade in on page load. I think it's done with javascript onload function. How can I do? Please help me.
yaksho is offline   Reply With Quote
Old 02-10-2010, 03:30 PM   PM User | #2
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
It's done with jQuery:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">
	#content_to_fade_in{
		display:none;
	}
</style>


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	var fade_duration = 1000		// milliseconds
	$('#content_to_fade_in').fadeIn(fade_duration);
});
</script> 


</head>

<body>

<div id="content_to_fade_in">
	<h1>I am fading in.</h1>
</div>

</body>
</html>
Spudhead is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:24 AM.


Advertisement
Log in to turn off these ads.