Skip to content

Instantly share code, notes, and snippets.

@simonwuyts
Created March 15, 2019 15:39
Show Gist options
  • Save simonwuyts/1b157e7c5b26d8714d3d9be0403e9c38 to your computer and use it in GitHub Desktop.
Save simonwuyts/1b157e7c5b26d8714d3d9be0403e9c38 to your computer and use it in GitHub Desktop.
<script>
function replaceFirstImage() {
var imageData = document.querySelector('[data-slideshow-history]').getAttribute('data-slideshow-url')
var visibleImage = document.querySelector('.slideshow__image__inner img')
$.getJSON(imageData, function(data) {
if (data.length > 1) {
var controls = document.querySelector('.slideshow__controls')
visibleImage.setAttribute('src', data[1].file)
controls.style.display = 'none'
}
})
}
replaceFirstImage()
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment