I am stumped and could really use some help with this gallery I’ve been working on. I used Ivan’s ‘4 lines of jquery gallery’ tutorial to get me where I am at currently. Here’s his demo which shows exactly how it all works http://workshop.rs/demo/gallery-in-4-lines/
I’ve hit the point where I would like to include a previous and back button.
As the images are named ‘1-large.jpg’,’2-large.jpg’,’3-large.jpg’… etc I tried using the .slice() to take the first digit then add 1 or minus 1 to it, resulting in the next/previous pic but that didn’t work well at all as my javascript skills are lacking and I don’t even know if it’s the best way to approach it.
My question is – Is using .slice() the way to go or is there a more simpler code I can use on my buttons?
Any help would be much appreciated.
If you just want the first character of a string:
but this won’t work for i > 9, so using split would be better:
and to convert string to int: