In Scriptaculous 1, you could animate styles:

new Effect.Morph('id', {
style: { background: tomato },
duration: '4' });

But a better way was to keep the CSS and JS separate and merely reference a class:

new Effect.Morph('id', {
style: 'important',
duration: '4' });

Marvellous. But this doesn't seem to work with the new Scripty 2. Works:

$('id').morph('background: tomato', { duration: 4 });

Breaks:

$('id').morph('important', { duration: 4 });

What is the right way to animate using a class in Scripty 2? (I suspected Style, but the docs were vague.)

Cheers.

1 answer

0
points

I've been playing around with Scripty 2 lately as well. From what I have gathered, you can't morph just by passing in a class name, you can only morph css properties just how you were doing it.

It's all still in alpha stages right now so morphing from one class to another will probably show up later in the framework.

Answered almost 7 years ago by Matt Milburn