var slideWidth = $('#carousel #slideContainer .slide').width();
var slidePos = (($('ul#carousel_nav li').index(this)) * slideWidth);
slidePos = Math.abs(slidePos) * -1;
$('#carousel #slideContainer .slide .slideContents').stop();
$('#carousel #slideContainer').stop();
$('#carousel #slideContainer .slide .slideContents').fadeOut( 500, function()
{
$('#carousel #slideContainer').animate({ left: slidePos }, 1000, function()
{
$('#carousel #slideContainer .slide .slideContents').fadeIn( 500 );
});
});
构建一个具有动画/回调链的 jQuery 滚动器。单击按钮时,div '#carousel #slideContainer .slide .slideContents
应该淡出并且其容器div '#carousel #slideContainer .slide .slideContents
移动 n 个像素(slidePos)
执行时,动画回调并不总是在前一个动画结束时触发,整个序列变得不连贯?!