Why the image sliding code is not running | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
9th Aug 2020, 7:13 AM
Avinash
9 Answers
+ 4
Avinash Are those local file images loading in the browser? If so, I learned something new. 🤔 When anyone else attempts to run your code, we will only see broken images because we don't have those images on our local devices. If this is loadings on your device, it wouldn't load from your computer because the images are only on your device. If the images load for you, what specifically happens when you click the buttons? Do the images change or is there no change? If no change, are there any error messages? If the images do change, then are you expecting the transition effect to show sliding movement? Are you able to see the images load and change with button clicks in Arnesh's code? I'm just trying to get a sense of what you mean by "not sliding".
9th Aug 2020, 2:04 PM
David Carroll
David Carroll - avatar
+ 3
document.getElementsById. ^ Delete the 's'. And put a '>' after the link tag.
9th Aug 2020, 7:18 AM
Pranav Kalro
Pranav Kalro - avatar
+ 2
1) You have that incomplete link tag. 2) There is no document.getElementsById but document.getElementById. (Notice the 's') 3) Your function was named 'pre' and you have been calling the 'prev' function. It should be 'prev'. 4) Use num.length and not num.le Your images won't load in sololearn. See this: https://www.sololearn.com/discuss/1392261/?ref=app Here is your edited code: https://code.sololearn.com/WmuyxUeLIjuA/?ref=app
9th Aug 2020, 7:24 AM
Arnesh
Arnesh - avatar
+ 2
Check the url if it is correct.
9th Aug 2020, 7:35 AM
Pranav Kalro
Pranav Kalro - avatar
+ 1
Stop using shortcuts eg: num.le instead of num.length You can getElementsById instead use ** document.getElementById
10th Aug 2020, 7:37 AM
Nickson Osiemo
Nickson Osiemo - avatar
0
I did all the necessary changes neither image is sliding in sololearn or my laptop
9th Aug 2020, 7:32 AM
Avinash
0
Pranav Kalro thanks man . But the image is not being sliding in my computer.
9th Aug 2020, 7:33 AM
Avinash
0
It's a local image url of your laptop hence work only on laptop if correct . Prepend/add file:/// before link might it works. It's necessary when I use to link img in my phone local img file example_ file:///storage/emulated/0/Download/download.jpeg
9th Aug 2020, 7:56 AM
Divya Mohan
Divya Mohan - avatar
0
9th Aug 2020, 1:03 PM
Avinash