Navigation Menu
Alphabetical Listing
Site Contents

Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner














Internet.com

IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Developer Channel

FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

General

Need to draw attention to something new on your Web page? Only need to show it for a moment or two? This script will highlight it in a subtle manner (or boldly, if you choose).


Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

Notes

Basic:

Choose the element, such as a paragraph, you would like to spotlight and give it a class of "fade":

Watch me fade

The paragraph will fade from the default color of yellow (#FFFF33) to whatever it's native background color is.

Advanced

Change the default fade from color:

<p id="paragraph1" class="fade-0066FF">Watch me fade from Blue</p>

Fade an element after the page load from a script (such as after an Ajax transaction):

Fat.fade_element("paragraph1")

The Fat.fade_element() function accepts several arguments: Target ID, Frames Per Second, Fade Duration, Fade Color, Final Color.

For example, if you wanted to fade paragraph1 from red to green at 60 frames per second for 10 seconds:

Fat.fade_element("paragraph1", 60, 10000, "#FF0000", "#00CC00")

Please note, the ID of the element is a required argument. As such all elements that you wish to fade (even by class) must have some unique ID. The ID can be anything.

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: fadeAnything.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

4. From: Michael
Thanks
10/31/2008 19:44:58

This was exactly what I was looking for--thanks!

P.S. It doesn't seem to work in Safari.

P.P.S. Any way to get a delay before it starts to fade?

2. From: Steven
11/28/2007 13:45:41

code flickerers

3. From: Lee (Admin)
12/04/2007 11:06:35

Yes, Steven, it's supposed to do that. It can flicker or just fade, as shown in the example. The first one flickers (actually it rapidly switches between two colors), the other does not.

1. From: Kenny
01/02/2007 01:20:38

It is really good!!!


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.