JoBCB
3 years ago
11 changed files with 392 additions and 755 deletions
File diff suppressed because it is too large
@ -0,0 +1,94 @@ |
|||
// PAGINATION — BROWSE THE ARCHIVES PAGES — GRID LAYOUT
|
|||
|
|||
// pagination script w/ support from @biberman on stackoverflow - big thanks!
|
|||
|
|||
let startPage; |
|||
const pageSize = 24; |
|||
const totalSlidePage = 5; |
|||
const pageCount = Math.ceil($(".browsethearchive-items").length / pageSize); |
|||
const slideRange = Math.floor(totalSlidePage / 2); |
|||
|
|||
slide = function() { |
|||
startPage = $("#pagin li a.current").parent().index(); |
|||
let paginationStart = (startPage - slideRange) <= 1 ? 0 : |
|||
(startPage >= (pageCount - slideRange) ? (pageCount - totalSlidePage) : |
|||
(startPage - slideRange - 1)); |
|||
|
|||
|
|||
$("#pagin li").hide(); |
|||
for (let t = paginationStart; t < (paginationStart + totalSlidePage); t++) { |
|||
$("#pagin li").eq(t + 1).show(); |
|||
} |
|||
|
|||
next.show(); |
|||
prev.show(); |
|||
|
|||
if (startPage == 1) { |
|||
prev.hide(); |
|||
} |
|||
if (startPage == pageCount ) { |
|||
next.hide(); |
|||
} |
|||
} |
|||
|
|||
showPage = function() { |
|||
console.log(startPage); |
|||
$(".browsethearchive-items").hide(); |
|||
$(".browsethearchive-items").each(function(n) { |
|||
if (n >= pageSize * (startPage - 1) && n < pageSize * startPage) |
|||
$(this).show(); |
|||
}); |
|||
} |
|||
|
|||
for (let i = 0 ; i < pageCount; i++) { |
|||
$("#pagin").append('<li><a href="#">' + (i + 1) + '</a></li> '); |
|||
|
|||
if (i > pageSize) { |
|||
$("#pagin li").eq(i).hide(); |
|||
} |
|||
} |
|||
|
|||
let prev = $("<li/>").addClass("prev").html("Prev").click(function() { |
|||
let prevLi = $("#pagin li a.current").parent().prev().find("a"); |
|||
|
|||
if (prevLi[0]) { |
|||
$("#pagin li a.current").removeClass("current"); |
|||
prevLi.addClass("current"); |
|||
} |
|||
|
|||
slide(); |
|||
|
|||
if (startPage != 0) { |
|||
showPage(); |
|||
} |
|||
}); |
|||
|
|||
let next = $("<li/>").addClass("next").html("Next").click(function() { |
|||
let nextLi = $("#pagin li a.current").parent().next().find("a"); |
|||
|
|||
if (nextLi[0]) { |
|||
$("#pagin li a.current").removeClass("current"); |
|||
nextLi.addClass("current"); |
|||
} |
|||
|
|||
slide(); |
|||
|
|||
if (startPage <= pageCount) { |
|||
showPage(); |
|||
} |
|||
}); |
|||
|
|||
$("#pagin").prepend(prev).append(next); |
|||
|
|||
$("#pagin li a").click(function() { |
|||
$('#pagin li a').removeClass('current'); |
|||
$(this).addClass('current'); |
|||
|
|||
slide(); |
|||
showPage(); |
|||
}); |
|||
|
|||
$("#pagin li a").eq(0).addClass("current"); |
|||
|
|||
slide(); |
|||
showPage(); |
@ -0,0 +1,94 @@ |
|||
// PAGINATION — BROWSE THE ARCHIVES — TABLE LAYOUT
|
|||
|
|||
// pagination script w/ support from @biberman on stackoverflow - big thanks!
|
|||
|
|||
let startPage; |
|||
const pageSize = 24; |
|||
const totalSlidePage = 5; |
|||
const pageCount = Math.ceil($("tr").length / pageSize); |
|||
const slideRange = Math.floor(totalSlidePage / 2); |
|||
|
|||
slide = function() { |
|||
startPage = $("#pagin li a.current").parent().index(); |
|||
let paginationStart = (startPage - slideRange) <= 1 ? 0 : |
|||
(startPage >= (pageCount - slideRange) ? (pageCount - totalSlidePage) : |
|||
(startPage - slideRange - 1)); |
|||
|
|||
$("#pagin li").hide(); |
|||
|
|||
for (let t = paginationStart; t < (paginationStart + totalSlidePage); t++) { |
|||
$("#pagin li").eq(t + 1).show(); |
|||
} |
|||
|
|||
next.show(); |
|||
prev.show(); |
|||
|
|||
if (startPage == 1) { |
|||
prev.hide(); |
|||
} |
|||
if (startPage == pageCount ) { |
|||
next.hide(); |
|||
} |
|||
} |
|||
|
|||
showPage = function() { |
|||
console.log(startPage); |
|||
$("tr").hide(); |
|||
$("tr").each(function(n) { |
|||
if (n >= pageSize * (startPage - 1) && n < pageSize * startPage) |
|||
$(this).show(); |
|||
}); |
|||
} |
|||
|
|||
for (let i = 0 ; i < pageCount; i++) { |
|||
$("#pagin").append('<li><a href="#">' + (i + 1) + '</a></li> '); |
|||
|
|||
if (i > pageSize) { |
|||
$("#pagin li").eq(i).hide(); |
|||
} |
|||
} |
|||
|
|||
let prev = $("<li/>").addClass("prev").html("Prev").click(function() { |
|||
let prevLi = $("#pagin li a.current").parent().prev().find("a"); |
|||
|
|||
if (prevLi[0]) { |
|||
$("#pagin li a.current").removeClass("current"); |
|||
prevLi.addClass("current"); |
|||
} |
|||
|
|||
slide(); |
|||
|
|||
if (startPage != 0) { |
|||
showPage(); |
|||
} |
|||
}); |
|||
|
|||
let next = $("<li/>").addClass("next").html("Next").click(function() { |
|||
let nextLi = $("#pagin li a.current").parent().next().find("a"); |
|||
|
|||
if (nextLi[0]) { |
|||
$("#pagin li a.current").removeClass("current"); |
|||
nextLi.addClass("current"); |
|||
} |
|||
|
|||
slide(); |
|||
|
|||
if (startPage <= pageCount) { |
|||
showPage(); |
|||
} |
|||
}); |
|||
|
|||
$("#pagin").prepend(prev).append(next); |
|||
|
|||
$("#pagin li a").click(function() { |
|||
$('#pagin li a').removeClass('current'); |
|||
$(this).addClass('current'); |
|||
|
|||
slide(); |
|||
showPage(); |
|||
}); |
|||
|
|||
$("#pagin li a").eq(0).addClass("current"); |
|||
|
|||
slide(); |
|||
showPage(); |
@ -0,0 +1,59 @@ |
|||
// --> custom scripts
|
|||
|
|||
// MAIN NAVIGATION MENU — MOBILE
|
|||
|
|||
function showMenu(navigationmobile){ |
|||
var e = document.getElementById('navigationmobile'); |
|||
var element = document.getElementById("mobtop"); |
|||
if(e.style.display == 'block') |
|||
e.style.display = 'none'; |
|||
else |
|||
e.style.display = 'block'; |
|||
document.querySelector('body').style.overflow = 'hidden'; |
|||
element.classList.toggle("mob-close-icon"); |
|||
} |
|||
|
|||
// HOMEPAGE — RECENTLY ADDED ITEMS GRID
|
|||
|
|||
$ShowHideMore = $('#home-recent-grid'); |
|||
$ShowHideMore.each(function() { |
|||
var $times = $(this).children('.home-recent-items'); |
|||
if ($times.length > 13) { |
|||
$ShowHideMore.children(':nth-of-type(n+13)').addClass('moreShown').hide(); |
|||
$(this).find('span.home-show').addClass('more-times').html('SHOW MORE'); |
|||
} |
|||
}); |
|||
|
|||
$(document).on('click', '#home-recent-grid > span', function() { |
|||
var that = $(this); |
|||
var thisParent = that.closest('#home-recent-grid'); |
|||
if (that.hasClass('more-times')) { |
|||
thisParent.find('.moreShown').show(); |
|||
that.toggleClass('more-times', 'less-times').html('SHOW LESS'); |
|||
} else { |
|||
thisParent.find('.moreShown').hide(); |
|||
that.toggleClass('more-times', 'less-times').html('SHOW MORE'); |
|||
} |
|||
}); |
|||
|
|||
|
|||
// SLIDER — ARTWORK TEMPLATE
|
|||
|
|||
var slider = tns({ |
|||
container: '.my-slider', |
|||
items: 1, |
|||
responsive: { |
|||
640: { |
|||
edgePadding: 20, |
|||
gutter: 20, |
|||
items: 1 |
|||
}, |
|||
700: { |
|||
gutter: 30 |
|||
}, |
|||
900: { |
|||
items: 1 |
|||
} |
|||
} |
|||
}); |
|||
|
Loading…
Reference in new issue