[Javascript] Combining Behaviors/Effects

Troy III Ajnej trojani2000 at hotmail.com
Mon Oct 17 06:53:43 CDT 2011


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
 
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               Troy III
      progressive art enterprise
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


> From: tedd at sperling.com
> Date: Tue, 4 Oct 2011 12:06:16 -0400
> To: javascript at lists.evolt.org
> Subject: [Javascript] Combining Behaviors/Effects
> 
> Hi gang:
> 
> I have a question for the group.
> 
> Given this example:
> 
> http://www.webbytedd.com/test/
> 
> As explained in the example, can these two behaviors/effects be combined?
> 
> In short, I would like to create a single "fade-cycle image replacement" technique. Both behaviors use the background image, but I can't seem to master the problem just yet. My current code and images are there for your review.
> 
> Any help, directions, solutions, or comments, will be appreciated.
> 
> Thanks,
> 
> tedd
> 
> _____________________
> tedd at sperling.com
> http://sperling.com
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript 		 	   		  


More information about the Javascript mailing list