Are jQuery's hide and slideUp methods equivalent?

Yosef picture Yosef · Mar 13, 2011 · Viewed 22.8k times · Source

Do slideUp('slow') and hide('slow') result in the same animation effects?

Example Code:

$(document).ready(function(){
  $("#hide").click(function(){
    $("p").hide('slow');
  });
  $("#show").click(function(){
    $("p").show('slow');
  });
});


<p>If you click on the "Hide" button, I will disappear.</p>
<button id="hide">Hide</button>
<button id="show">Show</button>

Answer

SLaks picture SLaks · Mar 13, 2011

No.

.slideUp('slow') animates the height and vertical padding to zero.
.hide('slow') also animates the width, horizontal padding, and opacity to zero.

To see the difference, paste javascript:void($('pre').hide(4000)) in the address bar in this page.