fix pager js
This commit is contained in:
parent
7f8ba8b1df
commit
21522b8c67
|
@ -27,6 +27,12 @@
|
||||||
return elems.length ? elems : false;
|
return elems.length ? elems : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pushClass(el, targetClass) {
|
||||||
|
if (isObj(el) && targetClass) {
|
||||||
|
elClass = el.classList;
|
||||||
|
elClass.contains(targetClass) ? false : elClass.add(targetClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
// from swift theme: sandwich
|
// from swift theme: sandwich
|
||||||
// ******
|
// ******
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -65,6 +71,26 @@
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
(function postsPager(){
|
||||||
|
const pager = elem('.pagination');
|
||||||
|
if (pager) {
|
||||||
|
pushClass(pager, 'pager');
|
||||||
|
const pagerItems = elems('li', pager);
|
||||||
|
const pagerLinks = Array.from(pagerItems).map(function(item){
|
||||||
|
return item.firstElementChild;
|
||||||
|
});
|
||||||
|
|
||||||
|
pagerLinks.forEach(function(link){
|
||||||
|
pushClass(link, 'pager_link')
|
||||||
|
});
|
||||||
|
|
||||||
|
pagerItems.forEach(function(item){
|
||||||
|
pushClass(item, 'pager_item')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
var fbposts = document.querySelector('#fbposts');
|
var fbposts = document.querySelector('#fbposts');
|
||||||
function whoops(error) {
|
function whoops(error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
Loading…
Reference in New Issue