« Back to UI/Effects

[edit]

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

Uses a specific effect on an element to hide the element if the first argument is an effect string.
Arguments:


effectString
The effect to be used. Possible values: 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.
optionsHash
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:
Apply the effect slide if you click on the p to hide a div.

    $("p").click(function () {
      $("div").hide("slide", {}, 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.slide.js"></script>

  <script>
  $(document).ready(function(){
    
    $("p").click(function () {
      $("div").hide("slide", {}, 1000);
    });

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

NameType