0
我試圖使用此圖像滑塊從文件夾位置獲取圖像,但未使用.eq()獲取圖像但我無法找出如何去做。圖像滑塊使用eq()獲取圖像嘗試將其更改爲var的圖像
var pages = $('#container li'),
current = 0;
var currentPage, nextPage;
var get_images = new Array("1.jpg", "2.jpg");
var handler = function() {
$('#container .button').unbind('click');
currentPage = pages.eq(current);
if ($(this).hasClass('prevButton')) {
if (current <= 0) current = pages.length - 1;
else current = current - 1;
nextPage = pages.eq(current);
nextPage.css("marginLeft", -604);
nextPage.show();
nextPage.animate({
marginLeft: 0
}, 800, function() {
currentPage.hide();
});
currentPage.animate({
marginLeft: 604
}, 800, function() {
$('#container .button').bind('click', handler);
});
} else {
if (current >= pages.length - 1) current = 0;
else current = current + 1;
nextPage = pages.eq(current);
nextPage.css("marginLeft", 604);
nextPage.show();
nextPage.animate({
marginLeft: 0
}, 800, function() {});
currentPage.animate({
marginLeft: -604
}, 800, function() {
currentPage.hide();
$('#container .button').bind('click', handler);
});
}
}
$('#container .button').click(handler);
謝謝sooo多!!!!! –