Frederick, thank you so much!
That was the final touch!!! It works beautifully!!
/Heine
On Jun 4, 7:49 pm, "Frederick Polgardy" <[EMAIL PROTECTED]> wrote:
> I'd try putting a test around the body of the function, to not do anything
> if the same link is clicked twice.
>
> <script>
> var current_box;
> function transition_effect(new_box) {
> if (new_box != current_box) {
> $(current_box).fade({duration: 0.2});
> $(new_box).appear({duration: 0.2});
> current_box = new_box;
> }}
>
> </script>
>
>
>
> On Wed, Jun 4, 2008 at 12:46 PM, Heine <[EMAIL PROTECTED]> wrote:
>
> > Thank you, Frederick... that did the trick!
>
> > I now have a very cool looking fade effect on these <div> tags...
>
> > One thing though: I discovered that if I click any of the links the
> > first time everything works as expected. However, IF I click the same
> > link twice, the corresponding <div> fades out since there is nothing
> > to show .. AND if I click the same link a third time, the
> > corresponding <div> will show briefly and then fade away agin.
> > Everything will however restores to normal when I click a different
> > link!
>
> > How could I stop this behavior so that if the new_box is empty,
> > current_box will remain the the default display item and no effect
> > will be applied?
>
> > Thank you so much so far, your helps is priceless to me!
>
> > /Heine
>
> > On Jun 4, 3:40 pm, "Frederick Polgardy" <[EMAIL PROTECTED]> wrote:
> > > The first time through current_box will be undefined so it won't work.
> > Try
> > > changing the first line to var current_box = 'budgetpositionbox'; or
> > > whatever you're going to have highlighted by default.
>
> > > On Wed, Jun 4, 2008 at 8:23 AM, Heine <[EMAIL PROTECTED]> wrote:
>
> > > > Hello again!
>
> > > > Maybe I'm not that good at C/P ... it won't work...
>
> > > > I've put the
>
> > > > " <script>
> > > > var current_box;
> > > > function transition_effect(new_box) {
> > > > $(current_box).fade({duration: 0.2});
> > > > $(new_box).appear({duration: 0.2});
> > > > current_box = new_box;
> > > > }
> > > > </script>"
>
> > > > (I assume that's how I'm supposed to do it?!?)
>
> > > > just beneath my <body>-tag and have then replaced some of the <a href>
> > > > on my page and have also changed the content of the
> > > > onclick="transition_effect('researchthemepositionbox');
>
> > > > Sadly, it's quite dead, I'm afraid ;-(
>
> > > > /Heine
>
> > > > On Jun 4, 3:07 pm, "Frederick Polgardy" <[EMAIL PROTECTED]> wrote:
> > > > > Keep in mind I'm not checking for boundary conditions like the first
> > time
> > > > > you click a link... Just trying to get you started.
>
> > > > > On Wed, Jun 4, 2008 at 8:05 AM, Frederick Polgardy <
> > [EMAIL PROTECTED]>
> > > > > wrote:
>
> > > > > > 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.
>
> > > > > --
> > > > > Science answers questions; philosophy questions answers.
>
> > > --
> > > Science answers questions; philosophy questions answers.
>
> --
> 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 [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
-~----------~----~----~----~------~----~------~--~---