added ability to display a variable number of images per page
This commit is contained in:
parent
092dec0b2f
commit
a88b920606
@ -1,5 +1,6 @@
|
||||
function ImageListSelection(position) {
|
||||
var selection = window.curGallery.imageList.slice(position,position+5);
|
||||
function ImageListSelection(position,count) {
|
||||
count = "number" == typeof count ? count : 5;
|
||||
var selection = window.curGallery.imageList.slice(position,position+count);
|
||||
window.curGallery.container.list.innerHTML = "";
|
||||
selection.forEach( function (e,i) {
|
||||
var element = elementPlace("#ImageList",e,"thumbnail","li");
|
||||
|
@ -1,4 +1,5 @@
|
||||
function initGalery(galleryName) {
|
||||
function initGalery(galleryName, pageCount) {
|
||||
pageCount = "number" == typeof pageCount ? pageCount : 5;
|
||||
window.curGallery = {};
|
||||
getImageList(window.api_url, galleryName);
|
||||
window.curGallery.Position = 0;
|
||||
@ -10,31 +11,31 @@ function initGalery(galleryName) {
|
||||
window.curGallery.controls.previous.innerHTML = "Previous";
|
||||
window.curGallery.controls.previous.onclick = function () {
|
||||
window.curGallery.controls.previous.innerHTML = "";
|
||||
if (window.curGallery.Position < 10) {
|
||||
if (window.curGallery.Position < pageCount*2) {
|
||||
window.curGallery.Position = 0;
|
||||
} else {
|
||||
window.curGallery.Position -= 5;
|
||||
window.curGallery.Position -= pageCount;
|
||||
window.curGallery.controls.previous.innerHTML = "Previous";
|
||||
}
|
||||
window.curGallery.controls.next.innerHTML = "Next";
|
||||
window.curGallery.controls.position.innerHTML = window.curGallery.Position + " - " + (window.curGallery.Position + 5) + " / " + window.curGallery.imageList.length;
|
||||
ImageListSelection(window.curGallery.Position);
|
||||
window.curGallery.controls.position.innerHTML = window.curGallery.Position + " - " + (window.curGallery.Position + pageCount) + " / " + window.curGallery.imageList.length;
|
||||
ImageListSelection(window.curGallery.Position,pageCount);
|
||||
};
|
||||
window.curGallery.controls.position = elementPlace(".controls","position",null,"div");
|
||||
window.curGallery.controls.position.innerHTML = window.curGallery.Position + " - " + (window.curGallery.Position + 5);
|
||||
window.curGallery.controls.position.innerHTML = window.curGallery.Position + " - " + (window.curGallery.Position + pageCount);
|
||||
window.curGallery.controls.next = elementPlace(".controls",null,"next button","div");
|
||||
window.curGallery.controls.next.innerHTML = "Next";
|
||||
window.curGallery.controls.next.onclick = function () {
|
||||
window.curGallery.controls.next.innerHTML = "";
|
||||
if (window.curGallery.Position >= window.curGallery.imageList.length - 10) {
|
||||
window.curGallery.Position = window.curGallery.imageList.length - 5;
|
||||
if (window.curGallery.Position >= window.curGallery.imageList.length - (pageCount*2)) {
|
||||
window.curGallery.Position = window.curGallery.imageList.length - pageCount;
|
||||
} else {
|
||||
window.curGallery.Position += 5;
|
||||
window.curGallery.Position += pageCount;
|
||||
window.curGallery.controls.next.innerHTML = "Next";
|
||||
}
|
||||
window.curGallery.controls.previous.innerHTML = "Previous";
|
||||
window.curGallery.controls.position.innerHTML = window.curGallery.Position + " - " + (window.curGallery.Position + 5) + " / " + window.curGallery.imageList.length;
|
||||
ImageListSelection(window.curGallery.Position);
|
||||
window.curGallery.controls.position.innerHTML = window.curGallery.Position + " - " + (window.curGallery.Position + pageCount) + " / " + window.curGallery.imageList.length;
|
||||
ImageListSelection(window.curGallery.Position,pageCount);
|
||||
};
|
||||
window.curGallery.controls.close = elementPlace(".controls",null,"close button","div");
|
||||
window.curGallery.controls.close.innerHTML = "Close";
|
||||
|
Loading…
x
Reference in New Issue
Block a user