MovingBoxes 플러그인이 도움이 될 수 있습니다.
$(window).load(function() {
var slideShowDelay = 4000, // 4000 millisecond = 4 seconds
timer,
mb = $('#slider').data('movingBoxes'),
loop = function() {
// if wrap is true, check for last slide, then stop slideshow
if (mb.options.wrap !== true && mb.curPanel >= mb.totalPanels) {
// click the button to pause
$('button.slideshow').trigger('click');
return;
}
// next slide, use mb.goBack(); to reverse direction
mb.goForward();
// run loop again
timer = setTimeout(function() {
loop();
}, slideShowDelay);
};
// toggle slideshow button
$('button.slideshow')
.attr('data-mode', "false") // slideshow paused
.click(function() {
clearTimeout(timer);
// slide show mode
var mode = $(this).attr('data-mode') === "false",
// button text, replace with <img> if desired
button = mode ? "Pause" : "Play";
if (mode) {
loop();
}
$(this).attr('data-mode', mode).html(button);
});
});
Demo