jQuery UI Scale Effect

The jQuery UI scale effect grows or shrinks an element by a percentage factor.

This is a jQuery UI effect, so the page using it must load jQuery UI in addition to jQuery.

Syntax and Main Options Top ↑

The general form is $(selector).effect(effectName, options, duration, complete). The options available depend on the selected effect.

  • direction: "both", "vertical" or "horizontal". Default: "both".
  • origin: Vanishing point array such as ["middle", "center"].
  • percent: Percentage to scale to.
  • scale: Choose "both", "box" or "content".
  • duration: Animation duration.
  • complete: Function called after completion.

Examples Top ↑

Basic syntax

$( "#element" ).effect( "scale", { direction: "both", percent: 80 }, 600, function () {
    // Runs after the effect finishes.
});

Default scale effect

$( "#d1" ).effect( "scale" );

Run from a button

$( "#b1" ).on( "click", function () {
    $( "#d1" ).effect( "scale" );
});

Set the target percentage

$( "#d1" ).effect( "scale", { percent: 80 } );

Scale only vertically

$( "#d1" ).effect( "scale", { direction: "vertical" } );

Toggle with scale and callback

$( "#b1" ).on( "click", function () {
    $( "#d1" ).toggle( "scale", 5000, function () {
        alert( "The scale toggle has finished." );
    });
});

Open the Scale Effect demo →

View demo of all jQuery UI effects →

When to Use This Effect Top ↑

Use this effect when the animation itself helps explain a state change or draws attention to an element. For routine interfaces, keep motion short and purposeful so it does not distract from the content.

← Previous effect · Next effect →

Back to jQuery Effects · jQuery Tutorials Home






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer