Pause script.aculo.us effects
Is it possible to pause all script.开发者_StackOverflow中文版aculo.us effects? So when I need I can just resume them from state where they were paused.
It wouldn't appear so, but I've found a post that has an interesting take on it, I don't know if the parameters of the effect would remain at the state where they were cancelled or if they are in the original state but it might be worth tinkering around with.
From: http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/f37ea88cba01c8a5
It seems that, for core effects with Script.aculo.us(including
Effect.Move
), the methodcancel()
works.Core effects include:
Effect.Highlight
,Effect.Morph
,Effect.Move
,Effect.Opacity
,Effect.Scale
,Effect.Parallel
,Effect.Tween
So you can do something like:
var myEffect = new Effect.Move(object, { duration: 5.0, x: 20, y: -30, mode: 'relative' });
myEffect.cancel();You can keep the effect reference object(in this example,
myEffect
) to stop it whenever you want, and start over again later with a new move effect.
精彩评论