-
-
Save Collinsmbaka/de7bb5d61a76ad9c40fbb86d328e3f43 to your computer and use it in GitHub Desktop.
Using buttons to control PageFly slider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('load', () => { | |
const id = Object.getOwnPropertyNames(__pagefly_slideshows__); | |
const slideId = id[0]; | |
const slideObj = __pagefly_slideshows__[slideId]; | |
const firstSlide = document.getElementById('button-1') | |
const secondSlide = document.getElementById('button-2') | |
const lastSlide = document.getElementById('button-3') | |
firstSlide.addEventListener("click", function () { | |
slideObj.scrollItem(0); | |
}) | |
secondSlide.addEventListener("click", function () { | |
slideObj.scrollItem(1); | |
}) | |
lastSlide.addEventListener("click", function () { | |
slideObj.scrollItem(2); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script used to use buttons to control PageFly slider