First and foremost, I have little experience with JQuery. I need to implement a toggle function in my final website. I would like the toggle to flip through as many images until it hits the last one (when it will then return to the first image). I have a folder of 30 images and I need to cycle around all of them by clicking on a button. So in resume:
1. Need a button
2. When button clicked, toggle through each image
3. After last image, return to first
Thanks to anybody with the experience and time to help. It will be immensely appreciated.
If anyone is willing to spend the extra time and effort, adding a "return to previous image" button would be overkill for my heart <3. If it is possible to toggle the images through the <img> tag rather than specifying the src, that would save me 30 image srcs to handle.
I've implemented the function on my page using your example.However, it is not working. I have tried the page in Chrome and Mozilla but no dice. I have:
- Declared the script and imported the necessary JQuery files
- Inserted the function in the head of the page
- Implemented the CSS
- Added the div with the images
I have not changed your code other than the formatting. The buttons and the first image show up just fine but the buttons are not functioning. I've already implemented other JQuery and AJAX on my page. I use Wamp Server for the AJAX. Not sure if the additional information helps, but nonetheless the more information the better. Thanks already for putting the effort in helping me out!