David and Kammy,

Thanks for both your responses, they were certainly helpful and
educational.

Ali

On Sep 22, 6:47 pm, KammylandSoftware <kammyl...@gmail.com> wrote:
> Actually,
>
>  I believe most, if not all, Effect.x() methods come with a method
> titled "cancel()";
>
>  What seems to be going on is that once the mouseout event occurs, you
> have the following line executed:
>
> new Effect.Move("popup-box", { x: 0, y: -10, mode: 'relative',
> transition: Effect.Transitions.spring});
>
> Since, you did not specify a "duration" parameter, the "duration"
> param gets set to 1.0 seconds by default. Therefore, should an on
> mouseover event occur whilst the above Effect.Move thread is being
> executed, the object will indeed be moved to "top: 20px" as you
> specify, but only to get moved up again by the Effect.Move thread upon
> its next object motion iteration.
>
> A hazardous way to fix this would be to set the "duration" parameter
> to something like 0.01 (one one-hundredths of a second) and be
> expedient upon the unlikelihood that anyone will do an "onmouseout -
> onmouseover" move in less that that tiny fraction of a second.
>
> The better way to do it is to create an accessible var such as
> animFadeOut and do:
>
> var animFadeOut = null;
> animFadeOut = new Effect.Move("popup-box", { x: 0, y: -10, mode:
> 'relative', transition: Effect.Transitions.spring});
>
> Then inside the block that handles showing the pop-up box in a springy-
> up like fashion you can use the cancel() method to do:
>
> if(animFadeOut != null)  animFadeOut.cancel();
> $("popup-box").setStyle({ top: '20px'});
> Effect.Appear("popup-box", { duration: .25 });
> new Effect.Move("popup-box", { x: 0, y: -10, mode: 'relative',
> transition: Effect.Transitions.spring});
>
> That should sort the code out matey.
>
> Cheers
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to