Navigation Menu

Site Contents
What's New?


Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Internet.commerce

Partner With Us
Baby Photo Contest
Home Improvement
Online Education
Hurricane Shutters
Memory
Dental Insurance
Best Price
Laptops
Memory Upgrades
Prepaid Phone Card
Disney World Tickets
GPS
KVM over IP
Promotional Products

Internet.com

IT
Developer
Internet News
Small Business
Personal Technology
International

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


General

This script produces a fading effect in a text box. The text can include any type of HTML and CSS styling. It can also be used with graphics. Small but powerful!


See how it looks!

Notes

The constructor, placed after the content, takes three variables: an array containing the ids of the divs to be faded, the fade time (in milliseconds), and the delay between fades (also in milliseconds):

var cf = new Crossfader( new Array('cf1','cf2','cf3'), 500, 2000 );

Source Code

Paste this source code into the designated areas.

External file

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


CSS

Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


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]

    
   
       
[optional field]
 
[optional field]

   

Comments feed Comment Feed RSS 2.0

7. From: Mark
06/29/2007 00:59:16

This is *very* cool! I was wondering if you had pointers on how to have this script on execute a fade once and not continously. Also, I'd like to have this effect executed only once per user session; so if a user revisits the page, only the the final image is displayed (with no fading effect).

Cheers!

Mark

4. From: Derek
JavaScript CSS Crossfader
06/17/2007 17:07:55

I thought this was going to be a really useful tool for my web-site, providing a rotating news box.

It worked fine but I applied styles from my main stylesheet to the text within the CF elements as the general notes says you can and the text changed to the correct size, weight, etc. but it was heavily pixilated - it looked about 25 ppi, not the normal 72.

Any ideas what the problem might be?

Many thanks, Derek.

5. From: Lee (Admin)
07/10/2007 15:41:46

You need to submit your question to the JavaScript Forum.

2. From: John Bellringer
06/17/2007 06:22:44

This cross fade appears to do nothing in Firefox 2.0.0.4 - at least, not on my PC

3. From: Lee (Admin)
07/10/2007 15:41:12

John,

Not sure what the problem is as it works on two of my machines.

6. From: Gene Wilkins
CSS Crossfader
06/15/2007 15:27:49

Magnificent!

Thank you very much!

1. From: Wutthichai
06/10/2007 23:08:33

That's Cool !!!


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.