From e7107c20b99b757f48886abcc5a95e6b80464180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Marchal?= Date: Sun, 14 Feb 2021 12:38:46 +0100 Subject: [PATCH] Mobile compatibility for pagination --- scripts/explorer.js | 12 +++++++++++- scripts/exposition.js | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/scripts/explorer.js b/scripts/explorer.js index 47f4311..99a8c3e 100644 --- a/scripts/explorer.js +++ b/scripts/explorer.js @@ -510,13 +510,23 @@ jQuery(document).ready(function($) // pagination + function getPageRange() + { + if (window.innerWidth >= 600) + return 6; + else if (window.innerWidth < 600 && window.innerWidth > 450) + return 4; + else + return 2; + } + var currentPage = 0; var previousArray = [] var options = { dataSource: paintingList, pageSize: pageSize, - pageRange: 6, + pageRange: getPageRange(), className: 'paginationjs-theme-ginou', callback: function (response, pagination) { diff --git a/scripts/exposition.js b/scripts/exposition.js index c921827..66c3cb8 100644 --- a/scripts/exposition.js +++ b/scripts/exposition.js @@ -38,13 +38,23 @@ jQuery(document).ready(function($) if (urlParams.get('page') != "") targetPage = urlParams.get('page'); + function getPageRange() + { + if (window.innerWidth >= 600) + return null; + else if (window.innerWidth < 600 && window.innerWidth > 450) + return 4; + else + return 2; + } + var currentPage = 0; var previousArray = [] var options = { dataSource: paintingList, pageSize: pageSize, - pageRange: null, + pageRange: getPageRange(), className: 'paginationjs-theme-ginou', callback: function (response, pagination) {