Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery prepend + fadeIn

I have this code:

$.ajax({         url : url,         data : {ids : JSON.stringify(jsonids), hotel_id: hotel_id},         success : function(response)         {             $('#be-images ul').prepend(response).fadeIn('slow');         },         dataType: 'html'     }); 

but the fade In does not work...I want the content to be prepended and faded in...how will I do this?

Thanks in advance!

like image 910
yretuta Avatar asked Dec 15 '09 08:12

yretuta


1 Answers

Assuming response is HTML then try this:

$(response).hide().prependTo("#be-images ul").fadeIn("slow"); 

When you do it this way:

$('#be-images ul').prepend(response).fadeIn('slow'); 

the thing you're actually fading in is the result of the initial selector (the list at the front), which is already visible.

like image 72
cletus Avatar answered Sep 19 '22 10:09

cletus