Multiple Effect.toggle
I couldn’t find a clear example on how to handle a blind down and a update with the same onlick event.
Here is what i came up with… im pretty sure there is a better way to do this but this worked just fine.
<span id=”group1_minus” style=”display:none;”><img src=”/images/buttons/small_minus.gif”></span>
<span id=”group1_plus” ><img src=”/images/buttons/small_plus.gif”></span>
<a href=”#” onclick=”Effect.toggle(’blinddown_group1′, ‘blind’, {duration: 0.5}); new Ajax.Updater(’tester’, ‘group1_swap’, {asynchronous:true, evalScripts:true});”>Group 1</a>
<div id=”blinddown_group1″ style=”display:none;”>
#cool stuff here
</div>
Then in the controller:
def group1_swap
render :update do |page|
page[:group1_minus].toggle
page[:group1_plus].toggle
end
end
This worked well for a side nav that needed to blind toggle and swap a +/- graphic to indicate if that section of the nav was open or closed. I havent tried it, but I imagine that you could do many Ajax Updaters in one onclick event.