Skip to content
Related Articles

Related Articles Scale Effect
  • Last Updated : 20 Nov, 2020

This effect is used for gradually scaling an element up or down, either vertically or horizontally. It changes an element width and height dimensions and the base for em units.


new Effect.Scale('element_id', percent, [options]);
new Effect.Scale(element, percent, [options]);

Effect Options

scaleXSets whether the element should be scaled horizontally, by default its true.
scaleYSets whether the element should be scaled vertically, by default its true.
scaleContentSets whether content scaling should be enabled, by default its true.
scaleFromCenterIf true, scale the element in a way that the center of the element stays on the same position on the screen, by default its false.
scaleModeEither ‘box’ (default, scales the visible area of the element) or ‘contents’ (scales the complete element, that is parts normally only visible byscrolling are taken into account). You can also control the size of the element by assigning the originalHeight and originalWidth variables to scaleMode. Example: scaleMode: { originalHeight: 900, originalWidth: 900 }
scaleFromSets the starting percentage for scaling, by default its 100.00.


<!DOCTYPE html>
    <title> examples</title>
    <script type="text/javascript" 
    <script type="text/javascript" 
src="./javascript/scriptaculous.js?load = effects">
    <script type="text/javascript">
        function ScaleEffect(element) {
            new Effect.Scale(element, 150);
    <div onclick="ScaleEffect(this)">
        <h3>Click me to Scale</h3>


My Personal Notes arrow_drop_up
Recommended Articles
Page :