Image slider not working. I can't seem to get this code to work. Help please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Image slider not working. I can't seem to get this code to work. Help please.

https://code.sololearn.com/WaIKdVxd5R6S/?ref=app

13th Oct 2022, 11:15 PM
Jefferson Ituen
Jefferson Ituen - avatar
6 Answers
+ 1
added a comment in the code where i made a change. hope u get it now. https://code.sololearn.com/W9V6BKIq2NlW/?ref=app
23rd Oct 2022, 4:35 PM
Niththish
Niththish - avatar
+ 1
1) you missed single quote in two places namely <img src= 'some link' alt=''/> inside your script:- var imageSource = [] 2) it's document.getElementById() and not document.getElementByID() check line:- 22 26 32 in your code https://code.sololearn.com/Wlgcxh04fRKJ/?ref=app Here is the corrected version of your code.
14th Oct 2022, 3:09 AM
Niththish
Niththish - avatar
+ 1
Check at line 41 It should be x = imageSource.length -1 inside function prevBtn() // some code here if(x<0){ x = imageSource.length-1 } //some code here
14th Oct 2022, 1:50 PM
Niththish
Niththish - avatar
+ 1
Thank you for your time Niththish , all my issues have been solved.
23rd Oct 2022, 10:18 PM
Jefferson Ituen
Jefferson Ituen - avatar
0
Thank you Niththish . I still have one more problem though. I can't seem to make the "prev" button reset the image to the last image in the array when the current image is the first image. Please reference the modified code I wrote. Thank you.
14th Oct 2022, 1:23 PM
Jefferson Ituen
Jefferson Ituen - avatar
0
Niththish , that doesn't seem to work for me. I have tried and it doesn't. Could you implement it into a code like you did the first?
23rd Oct 2022, 3:26 PM
Jefferson Ituen
Jefferson Ituen - avatar