Store the currently selected item in a page variable and then write your transition function to use it:
var current_box; function transition_effect(new_box) { $(current_box).fade({duration: 0.2}); $(new_box).appear({duration: 0.2}); current_box = new_box; } <a href="#" onclick="transition_effect('researchthemepositionbox'); return false;">Research Theme</a> Or something along those lines. -Fred On Wed, Jun 4, 2008 at 6:50 AM, Heine <[EMAIL PROTECTED]> wrote: > > Hi all! > > My first post here, so: be gentle ;-) > > I have been playing around with the scriptaculous library for a while > now, and I must admit it is great. However, there is one thing that > I'm notable to achieve: > > On Apple computers website for ilife (iphoto) > http://www.apple.com/ilife/iphoto/ > there is a verrrryyy nice fade effect going on when you click the > navigation for 'new in iPhoto '08', 'Organize by Events' etc. > > Is it possible to get this effect working with scriptaculous? > > So far, I've managed get things going part of the way with this ocde: > > "<a href="#" onmousedown="$('budgetpositionbox').fade({duration:0.2}); > return false;" onmouseup="$ > ('researchthemepositionbox').appear({duration:0.2}); return > false;">Research Theme</a>" > > Where the '...positionbox' is the <div> that fades in and out. > > BUT: my problem here is that I have to hard code things so that my > menu would be something like: > > > - Budget > - Research Theme > - Basic Requirements > - Evaluation > > By default the page loads with the 'budget' layer displayed and the > others hidden! > When I click on 'Research Theme' as my example shows, I fade the > budgetpositionbox out and make the researchthempositionbox appear. > > Everything works well, as longs as I click the links in the above > listed order. But everything falls apart when I click the links at > random, obviously since everything is hard coded. > > My question to this group is: Is there a way for me to know that the > layer to fade out will always be the layer that I'm leaving, and how > can I pick that up en i.e. a variable of some sort? > > Have in mind that I'm not very skilled at JavaScript, but I'm very > good at copy/paste!! > > Thank you > -- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---