Re: jQuery - hiding and showing content.
Posted: Wed Apr 20, 2011 4:59 am
You will need too use css. See example below:
The idea is to use "absolute" positioning. This way, both divs are in exactly the same place, one in top of another. Now, you use jQuery fadeIn and fadeOut, exactly as you did, nothing to change here.
Code: Select all
<div style="position: relative;"> <-- you need to put "relative" here, otherwise "absolute" positioning will not work as you expect -->
<div style="position: absolute; top: 0; left: 0;">this is first div</div>
<div style="position: absolute; top: 0; left: 0;">this is second div</div>
</div>