This is the next function that i learn from other's post and i wonder how to do the prev function.
any idea guys? Different approach are welcome as well.
function next() {
var pElems = document.querySelectorAll('#Pages>div');
for (var i = 0; i < pElems.length; i++) {
if (pElems[i].style.display !== 'none') {
pElems[i].style.display = 'none';
if (i === pElems.length - 1) {
pElems[0].style.display = 'block';
} else {
pElems[i + 1].style.display = 'block';
}
break;
}
}
}
i == pElems.lenghth + 1in combination withpElems[i - 1].style.displayetc. So may possibilities, just play around with it a bit.