"position": "absolute",
"top": 0,
"left": zeroPosition
});
// setup the next slide to slide in, moving it above the focused slide and off screen
$next.css({
"opacity": 0,
"position": "absolute",
"top": 0,
"left": initialLeft,
"z-index": 3
});
// animate the current slide out
$focus.animate({
"opacity": 0,
"left": targetLeft
}, 800);
// set up what we're animating
var animation = {
"opacity": 1,
"left": zeroPosition
}
// horrible ie fix
if ($.browser.msie && parseInt($.browser.version) <= 8)
{
delete animation.opacity;
$focus.get(0).style.removeAttribute('filter');
$next.get(0).style.removeAttribute('filter');
}
// animate in the next slide, then upon completion reset everything. switch it back to
// relative positioning, remove our animation flag and hide the previous element
$next.show().animate(animation, 800, function()
{
$focus.hide();
$(this).css({
"position": "relative",
"left": 0
});
// fix msie
if ($.browser.msie && parseInt($.browser.version) <= 8)
{
this.style.removeAttribute('filter');
}
$carousel.prop('moving', false);
});
// animate the height of our carousel, because things are abosulte the box model is shot
$carousel.animate({
//"min-height": $next.outerHeight()
});
// finally update our index to reflect the current view
$carousel.prop('index', newIndex);
});
$(document).delegate('.carousel .pause', 'click', function(event)
{
// prevent the default anchor action
event.preventDefault();
// localize the carousel
var $carousel = $(this).parents('.carousel');
// get the current timer, if it exists
var timer = $carousel.prop('timer');
// no timer? start it
if (!timer)
{
start($carousel);
}
// timer? stop it
else
{
stop($carousel);
}
});
// start a new timer, additionally update the play/pause button to the correct visual state
function start($carousel)
{
timer = setInterval(function()
{
$carousel.find('.next').eq(0).trigger('click');
//N.C.: added to stop carousel after one round.
var index = $carousel.prop('index');
if ( index==0 && carousel_round > 0 ) {
stop($carousel);
}
else if ( index==1 ) {
carousel_round++;
}
}, 5000);
$carousel.prop('timer', timer);
$carousel.find('.play.pause').removeClass('play');










