I am using jquery animate function to move a block in my content div. The basic structure is as follows:
<div class="content">
<div>block 1</div>
<div>block 2</div>
<div>block 3</div>
</div>
My js:
//main menu clicked:
$('#nav').children().click(function(e){
e.preventDefault();
var current = $('.selected').index();
var clicked = $(this).index();
if(current != clicked){
if (current < clicked) {
clickedLeft = 1400
currentLeft = -1400
$('#content-'+clicked).css('left', clickedLeft);
} else {
clickedLeft = -1400
currentLeft = 1400
$('#content-'+clicked).css('left', clickedLeft);
}
$('#content-'+current).animate({left: currentLeft}, 1500, 'easeInOutSine', function(){ $('#content-'+current).hide(); });
$('#content-'+clicked).show().animate({left: 0}, 1500, 'easeInOutSine');
}
});
When I click particular menu link, corresponding div will move to the center and div which is in the center will move to opposite. Everything working fine but my block has different elements like img p li etc., so I want to move those elements at different speed. Is it possible? or should I animate each elements of blocks separately? I cannot give animate to each of the elements because they are retrieved from db, so not always the same elements show up.
Live example: dida.uz