Last active
November 29, 2017 09:38
-
-
Save gadzhimari/6632e48d9ae04785a2b977d2dcc5a5c5 to your computer and use it in GitHub Desktop.
Calculation formula of prev and next slide
This file contains hidden or 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
const images = ['1.jpg', '2.jpg', '3.jpg']; | |
const total = images.length; | |
const next = (current + 1) % total; | |
const prev = (current + (total - 1)) % total; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment