Swipe Navigation

On touchscreen enable devices, in additon to the Previous and Next nav bar buttons you can also swipe right (previous) and left (next) to navigate the site.
Swipe navigation is not a feature of MkDocs but is a custom modification included in this template.

custom/js/swipenav.js

For details see the following JavaScript code.

var links = document.getElementsByTagName("a");

for (l in links) {
  if (String(links[l].innerHTML).match(/fa-arrow-left.*Previous/)) {
  // if (links[l].innerHTML == '<i class="fa fa-arrow-left"></i> Previous') {
    links[l].classList.add("previous")
    // console.log(l + ' [' + links[l].innerHTML + '] ' + links[l].href)
  }
  if (String(links[l].innerHTML).match(/Next.*fa-arrow-right/)) {
  // if(links[l].innerHTML == 'Next <i class="fa fa-arrow-right"></i>') {
    links[l].classList.add("next")
    // console.log(l + ' [' + links[l].innerHTML + '] ' + links[l].href)
  }
}

$("body").on('swipeleft', function(e) {
  if ($(".next").attr('href')) {
    window.location.replace( $(".next").attr('href') );
  }
});

$("body").on('swiperight', function(e) {
  if ($(".previous").attr('href')) {
    window.location.replace( $(".previous").attr('href') );
  }
});