views:

376

answers:

1

I want to achieve an effect on a certain div with scriptaculous that does the following:

  1. The div will blindUp.
  2. After that effect is complete, the contents of the div will change.
  3. The div will then blindDown with the new contents.

So I know there is the effect queue which is awesome, but how can the contents only after the blindUp effect is complete?

Also is there a way to make toggle work with the queue?

+2  A: 

You can do this with queues and delays, but this is the simplest.

new Effect.BlindUp('something',{afterFinish:function() {
   $('something').innerHTML="###";
   new Effect.BlindDown('something');
  }    
})

You can then wrap this in a function, pass it the new content and make it behave like a toggle.

Additional documentation is here: http://proto-scripty.wikidot.com/scripty:how-to-timing-and-sequencing-animations

Diodeus
Haven't tried it yet, but that looks awesome! I've been looking for some sort of 'oncomplete' option in the documentation but never found one.
tybro0103
You may want to take a look at my wiki entry on this topic: http://proto-scripty.wikidot.com/scripty:how-to-timing-and-sequencing-animations
Diodeus
Just as a note to anyone who may copy and paste the above code: It's actually 'afterFinish' instead of 'afterfinish', and there's a couple semicolons missing.
tybro0103
I'll fix that. It was straight out of my head.
Diodeus