resources/script.js
function navigate(n) {
  var position = currentPosition();
  var numSlides = document.getElementsByClassName('slide').length;

  /* Positions are 1-indexed, so we need to add and subtract 1 */
  var nextPosition = (position - 1 + n) % numSlides + 1;

  /* Normalize nextPosition in-case of a negative modulo result */
  nextPosition = (nextPosition - 1 + numSlides) % numSlides + 1;

  document.getElementById('slide-' + position).classList.add('hidden');
  document.getElementById('slide-' + nextPosition).classList.remove('hidden');

  updateProgress();
  updateURL();
  updateTabIndex();
}
function navigate(n) {
  var position = currentPosition();
  var numSlides = document.getElementsByClassName('slide').length;

  /* Positions are 1-indexed, so we need to add and subtract 1 */
  var nextPosition = (position - 1 + n) % numSlides + 1;

  /* Normalize nextPosition in-case of a negative modulo result */
  nextPosition = (nextPosition - 1 + numSlides) % numSlides + 1;

  document.getElementById('slide-' + position).classList.add('hidden');
  document.getElementById('slide-' + nextPosition).classList.remove('hidden');

  updateProgress();
  updateURL();
  updateTabIndex();
}
function navigate ( n ) { var position = currentPosition ( ) ; var numSlides = document . getElementsByClassName ( 'slide' ) . length ; /* Positions are 1-indexed, so we need to add and subtract 1 */ var nextPosition = ( position - 1 + n ) % numSlides + 1 ; /* Normalize nextPosition in-case of a negative modulo result */ nextPosition = ( nextPosition - 1 + numSlides ) % numSlides + 1 ; document . getElementById ( 'slide-' + position ) . classList . add ( 'hidden' ) ; document . getElementById ( 'slide-' + nextPosition ) . classList . remove ( 'hidden' ) ; updateProgress ( ) ; updateURL ( ) ; updateTabIndex ( ) ; }
Navigates forward n pages
If n is negative, we will navigate in reverse
Navigates forward n pages If n is negative we will navigate in reverse