You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
import List from "list.js";
document.addEventListener("DOMContentLoaded", function () {
let itemsPerPage = 60;
let items = itemsPerPage; // using for calculate paginate
/* init list js */
const listJS = new List('item-list--container', {
valueNames: ['item'],
page: itemsPerPage,
pagination: true,
searchClass: 'search-input'
});
/* function prev button */
document.getElementById('prev-btn').addEventListener('click', function(event) {
event.preventDefault();
// get current page/list item active
const activeItem = document.querySelector('ul.pagination li.active');
// verify if exists prev page
if (activeItem.previousElementSibling !== null) {
// calculate prev page using total pages
listJS.show( listJS.i - listJS.page, itemsPerPage);
}
});
// function prev button
document.getElementById('next-btn').addEventListener('click', function(event) {
event.preventDefault();
// get current page/list item active
const activeItem = document.querySelector('ul.pagination li.active');
// verify if exists next page
if (activeItem.nextElementSibling !== null) {
// calculate next page using total items.
listJS.show(listJS.i + items, itemsPerPage);
}
});
});
`
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: