I think if you save the effect reference you could call the cancel
method which I believe would halt the effect at whatever point it was
in its processing and then start a new slide up effect, you'd have to
test that out though.

Also I'd avoid globals at all costs in dealing with effects, as im
sure your menu has multiple pull downs.  Try just using properties of
the elements you're effecting, then they'll be scoped within the
element.



On Jul 5, 6:21 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I was hoping to avoid extending/re-implementing the base effects, as
> I'd like to build a Cookbook of scriptaculous code which use the core
> effects.
>
> After playing with it some more, I found a way around it.
>   - Keep some JS globals for whether the dropdown is open, changing,
> or eligible to be closed.
>   - On mouseover, fire the effect, tweak the globals, and plant a
> timeout for closing the dropdown.
>   - The timeout loops unless the vars are set for closure, at which
> point is fires the reverse effect.
>
> Might have been nice to do with callbacks/partial effects, but this
> seems pretty robust. Thanks all.
>
>    bsr
>
> On Jul 5, 1:00 pm, Diodeus <[EMAIL PROTECTED]> wrote:
>
> > Doing a slideup/down effect isn't really hard to program. You could
> > set your own events and flags inside the functions themselves to do
> > what you want to accomplish. I needed a slide-right, slide-left, so I
> > wrote a little function myself. You may want this as a starting point
> > to build your own. It's not very elegant but it works.
>
> > function showAdvanced(p) {
> >         Element.show('advancedPanel')
> >         $('advancedPanel').style.left=p+"px"
> >         if(p>199) {
> >                 return;
> >         }
> >         else {
> >                 p = p + 20
> >                 x=setTimeout("showAdvanced("+p+")",10)
> >         }
>
> > }
>
> > On Jul 5, 12:46 pm, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > Hi all. I'm trying to use the SlideDown/SlideUp effects to build nifty
> > > dropdown menus. I've run into a few stumbling blocks and wanted to run
> > > things by the experts. So two questions:
>
> > > - Is there a way to figure out the progress so far in an event? I'd
> > > like it so when you mouseout of menu that's in the process of sliding
> > > down from a mouseover, that is stop halfway and start sliding up
> > > immediately. This requires that I get the current percentage progress
> > > from the SlideDown, stop that event, and start a new SlideUp that
> > > starts with that value for progress. I didn't see any property in the
> > > effect for this.
>
> > > - Is there an event that fires at the end of an effect that lets me
> > > set a callback? Seems like that would be pretty handy.
>
> > > The website's article on EffectQueues was pretty handy for all 
> > > this:http://wiki.script.aculo.us/scriptaculous/show/EffectQueues


--~--~---------~--~----~------------~-------~--~----~
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