내가 개발 한 제품을 신속하게 조합 한 것입니다 (전혀 테스트하지 않았으며 단지 아이디어 용입니다). 어렵지 않아야합니다.
var imgs = ['a.png', 'b.png', 'c.png'];
function Slideshow(img_list, container) {
var self = this;
var $slides = [];
var current = { 'ith': 0, '$slide': null };
function initialize() {
// Create the images
img_list.map(function (i) {
$slides.push($('<img>').attr('src', i).hide().appendTo(container));
});
current.$slide = $slides[0];
current.ith = 0;
// Initialize binds (jquery hotkeys or something)
$(document).bind('keydown', '>', function() {
// Do stuff
self.next();
});
$(document).bind('keydown', '<', function() {
// Do stuff
self.prev();
});
};
this.indexTo = function (i) {
current.$slide.hide();
current.$slide = $slides[i];
current.ith = i;
if (current.$slide ==== undefined) {
if (i < 0) {
current.$slide = $slides[$slides.length - 1];
current.ith = $slides.length - 1;
} else {
current.$slide = $slides[0];
current.ith = 0;
}
}
// Effects or something else
return current.$slide.show();
};
this.next = function() {
return self.indexTo(current.ith++);
};
this.prev = function() {
return self.indexTo(current.ith--);
};
initialize();
};
귀하의 특정 요구 사항에 대해, 당신은 자신의 쓸 수 너무 어렵지 않아야합니다. –
플러그인 요구 사항에 따라 출력을 수정할 수 없습니까? 즉, o/p를 배열에서 플러그인이 소비하는 모든 것으로 변환합니다. –
그래, 내가 아프게해야 할 일이라고 생각해. 쉬운 방법이 있었으면 좋겠어. 이미 잘 된 슬라이드 쇼를 수정하는 것이 더 좋을 것 같아. – mkoryak