dven a écrit :
> How can i add a fade effect like fading out and in or just fading in
> to the code above.

You'll need to have prototype.js and effects.js loaded.  The code below 
assumes recent versions (say, 1.6.0.2 and 1.8.1, resp.).

Just use fade/appear instead of your display settings (which, btw, could 
have been done using show/hide:

   content_divs.invoke('fade');
   content_divs[id].appear();

Perhaps you want that to be pretty quick, instead of the 1-second 
default duration.  I'm fond 1/4" myself:

   content_divs.invoke('fade', { duration: 0.25 });
   content_divs[id].appear({ duration: 0.25 });

And if there's just one of your items in content_divs that's visible, 
and needs hiding, you should keep a ref to it instead of iterating.  But 
if you won't keep a ref, you should avoid triggering n-1 useless 
effects, so:

   content_divs.each(function(div) {
     if (div.visible())
       div.fade({ duration: 0.25 });
   });
   content_divs[id].appear({ duration: 0.25 });

'HTH

-- 
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to