Slideshow with updating URI location

var fadeDuration = 2000

$(function () {
  var $slides = $("#slideshow > div")

  var currentSlide = Number(location.hash.slice(1))

  $ () {
    if (currentSlide == $slides.length) currentSlide = 0
    location = "#" + currentSlide

This is pretty rough, but it does two notable things. First, a slideshow that advances on click with a fade from one div to another. More interestingly, it sets the URI with the slide number, and retrieves the number on load. In other words, it’s an bare-bones implementation of a persistent URI system.

January 28, 2019 JavaScript

Written by Alesh Houdek, a web developer in Colorado. This is mostly code snippets and ideas I might want to reuse. HomepageTwitter