This effect changes the CSS properties of an element.
Style as a hash (keys should be javascript names, rather than CSS ones i.e. ‘backgroundColor’ rather than ‘background-color’):
Effect-specific paramters
Option Description
style the target style of your element, writing with the standard CSS syntax, or as a hash
[url]http://wiki.script.aculo.us/scriptaculous/show/Effect.Morph[/url]
Simple :
$('morph_example').morph('background:#080;color:#fff');
Complex :
new Effect.Morph('error_message',{
style:'background:#f00; color:#fff;'+
'border: 20px solid #f88; font-size:2em',
duration:0.8
});
Style as a hash (keys should be javascript names, rather than CSS ones i.e. ‘backgroundColor’ rather than ‘background-color’):
Effect-specific paramters
Option Description
style the target style of your element, writing with the standard CSS syntax, or as a hash
[url]http://wiki.script.aculo.us/scriptaculous/show/Effect.Morph[/url]
本文介绍了一种使用Scriptaculous库中的Effect.Morph方法来改变HTML元素CSS样式的技巧。通过简单的示例代码展示了如何设置背景颜色和文字颜色,以及更复杂的样式变化,包括边框宽度、字体大小等。
65

被折叠的 条评论
为什么被折叠?



