Reputation: 7795
I've been messing with the fadein fadeout functions in jquery and would like to know if it's possible that the div below slides upwards instead of jumping up as soon as the div above it disappears. Here's a little jsfiddle I did :)
http://jsfiddle.net/pufamuf/2j5FU/1/
Thanks again :)
Thanks to everyone that helped me out, I really appreciate it! :)
Upvotes: 2
Views: 656
Reputation: 31033
try using animate
$("input[type='button']").click(function() {
switch (this.id) {
case 'button1':
$('#div1').fadeIn(200);
$("#div1").animate({opacity: 1}, 2000,function(){
$(this).slideDown();
});
break;
case 'button2':
$("#div1").animate({opacity: 0}, 2000,function(){
$(this).slideUp();
});
break;
}
});
Upvotes: 1
Reputation: 23132
Use slideDown
and slideUp
instead of fadeIn
and fadeOut
respectively.
http://jsfiddle.net/FishBasketGordo/H87pc/
Upvotes: 1
Reputation: 527
Have you tried slideUp() and slideDown() instead of fadeIn and fadeOut? That should provide the effect your looking for.
Upvotes: 1