« Back to UI/Effects

[edit]

### effect( effect, options, [speed], [callback] )

Uses a specific effect on an element (without the show/hide logic).
Arguments:

effect | String |
The effect to be used. Possible values: 'blind', 'bounce', 'clip', 'drop', 'explode', 'fold', 'highlight', 'puff', 'pulsate', 'scale', 'shake', 'size', 'slide', 'transfer'.
options | Hash |
A object/hash including specific options for the effect.
speed (Optional) | String, Number |
A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
callback (Optional) | Function |
A function that is called after the effect is completed.

Examples:

Name | Type
--- | ---

- Demo
- View Source

Apply the effect explode if you click on the element.

        $("div").click(function () {
          $(this).effect("explode", {}, 1000);
        });

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                        "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
      <script src="http://code.jquery.com/jquery-latest.js"></script>

      <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script>
    <script src="http://ui.jquery.com/latest/ui/effects.explode.js"></script>

      <script>
      $(document).ready(function(){

        $("div").click(function () {
          $(this).effect("explode", {}, 1000);
        });

      });
      </script>
      <style>
      div { margin: 0px; width: 100px; height: 80px; background: blue; position: relative; top: 20px; left: 20px; }
      </style>
    </head>
    <body>
      <div></div>
    </body>
    </html>