|
Categories
Other Sections
Sweet Ads
Compatibility
|
|
FF1+ IE5+ Opr8+
Gradual Element Fader Author:
Description: This is a generic fader script
that can be applied to element(s) on the page to make them gradually fade into
view when the mouse rolls over them, and fade out when out. Just give the desired elements on the page a " Another Web 2.0 effect for the masses! Demos:
JavaScript is a scripting language originally developed by Netscape to add interactivity and power to web documents. It is purely client side, and runs completely on the client's browser and computer.
DHTML is the embodiment of a combination of technologies- JavaScript, CSS, and HTML. Through them a new level of interactivity is possible for the end user experience.
Step 1: Insert the below into the HEAD section of your page: The above code references an external js file, which you need to download:
Then, to apply the effect to any element on your page with a dimension, give
it a <img src="test.gif" class="gradualfader" /> Step 2: At the very bottom of your page following all your
elements (ie: right above the <script type="text/javascript"> CustomizingYou can fine tune the effect if you wish inside the .js file: gradualFader.baseopacity=0.4 //set base opacity when
mouse isn't over element (decimal below 1) The first variable sets the default opacity of participating elements when the mouse isn't over them (0=completely opaque, 1=fully normal). The second controls how fast the fade effect animates- the larger the number, the faster. LimitationsIn IE, with the exception of images, the element you're applying the effect to must have a
"layout" (such as a "
With that said, the below won't activate the effect in IE: <p class="gradualfader" /> while the following will: <p class="gradualfader" style="width: 95%" /> Non ObtrusivenessThis script is designed to work in an non obstructive fashion. Browsers that have JavaScript turned off will simply see the elements in their untouched, original state.
|