[Javascript] Combining Behaviors/Effects

Tedd Sperling tedd at sperling.com
Tue Oct 18 11:27:53 CDT 2011


On Oct 17, 2011, at 7:53 AM, Troy III Ajnej wrote:
> Hi Tedd,
> 
> I've written this example; it will need 
> a little tweaking for a wider range of
> browser support, but I think it's a healthy 
> code to start with
> 
> ------------ js code --------------------
> 
> function fade( e, El ){
> fade.Element = fade.Element || El || this;
>  fade.action = !!e ? e.type : fade.action;
>  fade.trans = fade.trans || 0;
> 
> if( fade.action == 'mouseover' ){
>  fade.trans < 100 ? 
>   fade.Element.style.opacity
>    = fade.trans++/100
>    : clearTimeout(fade.time)
> }
> if( fade.action == 'mouseout' ){
>  fade.trans > 0 ? 
>   fade.Element.style.opacity  
>    = fade.trans--/100 
>    : clearTimeout(fade.time)
> }
> fade.time = setTimeout( 'fade()', 10 )
> }
> 
> -----------------------------------------
> *Assign the "fade" function to the corresponding 
> events on your image overlay.
> 
> If any questions; Don't hesitate to ask

Thanks Troy.

I'm still working on it.

Cheers,

tedd

_____________________
tedd at sperling.com
http://sperling.com


More information about the Javascript mailing list