Skip to content

Commit

Permalink
Last Update
Browse files Browse the repository at this point in the history
  • Loading branch information
fw-amgaa committed May 28, 2020
1 parent 7148ca7 commit fabb9af
Show file tree
Hide file tree
Showing 4 changed files with 689 additions and 15 deletions.
41 changes: 41 additions & 0 deletions item-counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var itemcount = document.querySelectorAll('.c-products__items--item');
var allitems = document.getElementById('allitems');
allitems.innerHTML = itemcount.length;

var m = 1;
var counter = 1;
for(i=0; i<itemcount.length; i++){
itemcount[i].setAttribute("name", m);
counter++;
if(counter > 16){
m++;
counter = 1;
}
}


var pages = (itemcount.length - 1) / 16 + 1;

var pagejs = '';
for(var i=1; i<=(pages); i++){
pagejs += '<a href="page-' + i + '">' + i + '</a>';
}


var pageclass = document.querySelector('#navigation');
pageclass.innerHTML = '<div class="c-content__nav--navigation"> <span class="material-icons"> chevron_left </span>'
+
pagejs
+
'<span class="material-icons"> chevron_right </span></div>'

var b = (itemcount.length - 1) % 16 + 1;
var blyat = Math.floor(pages);

document.getElementById('currentitems').innerHTML = b;

for(i=0; i<itemcount.length; i++){
if(itemcount[i].attributes('name') != 1){
itemcount[i].classList.add('none');
}
}
Loading

0 comments on commit fabb9af

Please sign in to comment.