This appears to be some strange problem with Effect.toggle
. If you give the div
elements id
values, your code works: http://jsbin.com/ifeqek/1 If you don't, you get the effect you're seeing: http://jsbin.com/ifeqek/3
So I'd probably update toggle_class
to:
function toggle_class(cssClass) {
$$(cssClass).each(function(s){
s.identify(); // <======== The new bit, assign an id if there isn't already one
new Effect.toggle(s, 'blind', { duration: 0.3 });
});
}