Set a flag that prevents the function from executing if the fade/
appear action is already running.

var running = 0

function fadeMe() {
    if(running==1) {
        return
    }
    running = 1
    new Effect.Fade('something',afterFinish:function(){running=0})

}

On Oct 26, 12:34 am, Ngan Pham <nganp...@gmail.com> wrote:
> Hi everyone, I have quick question:
>
> I which to make a div appears (Effect.Appear) and disappears (Effect.Fade)
> when the mouse is moved over and out of a div.  Problem is the effect would
> collide with each other if the mouse goes over, out, over, out too quickly.
>  What is the best way to stop the effect midway and reverse it so that it
> won't flicker.
>
> Currently I'm doing this:  I keep an "var effect = Effect.Appear"...If
> effect exists and is running when the mouse goes over, I effect.cancel() it
> and get the opacity and call Fade on it passing in "from" argument.  I'm not
> using queues or anything.  Is this the best/only way?
>
> Or is there a absolutely better/best way of doing this?
--~--~---------~--~----~------------~-------~--~----~
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