jquery .hide().fadeIn()

Mackelito picture Mackelito · Jan 26, 2012 · Viewed 21.1k times · Source

This is my code:

$('.items').html(response).hide().fadeIn();

The problem is that when this is loaded the page "jumps" up due to that the .hide().. is there some other way to do this?

Answer

Steve O picture Steve O · Jan 26, 2012

You could using the opacity instead if you want to keep the dimensions of the element intact:

$('.items').html(response).css({'opacity':0}).animate({'opacity':1});