This effect changes the CSS properties of an element.
script.aculo.us V1.7 and later.
Simple :
$('morph_example').morph('background:#080;color:#fff');
new Effect.Morph('error_message',{
style:'background:#f00; color:#fff;'+
'border: 20px solid #f88; font-size:2em',
duration:0.8
});
new Effect.Morph('example',{
style:{
width:'200px'
}
});
You can also use $(‘element_id’).morph({width:’200px’}), which is a bit shorter.
| Option | Description |
| style | the target style of your element, writing with the standard CSS syntax, or as a hash |
Effect.Morph takes orginal styles given by CSS style rules or inline style attributes into consideration when calculating the transforms. It works with all length and color based CSS properties, including margins, paddings, borders, opacity and text/background colors.
Because Effect.Morph queries the original values with Prototype’s Element.getStyle API, it doesn’t matter whether these styles are set inline or in an external stylesheet definition. Of course the effect supports all usual options, like duration or transition.