can anybody explain the function of image slider please? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can anybody explain the function of image slider please?

20th Sep 2016, 7:48 AM
Sushant Borsania
Sushant Borsania - avatar
2 Answers
+ 1
Hi, the whole tip is to use js to modify the .style.display of an image, hide all the images exept for the current one, try to put the images in divs, or use a js function to generate the divs and append images on them if you have a lot, then append the divs to container div, the divs containing the images should have a className, the container div.elementChildCount should returns the number of images, and each div that contain an image have an index, create a function that hide all the class[index] exept for the current one, there many exemples in the internet.
20th Sep 2016, 10:18 PM
ADEL MAHJOUB
ADEL MAHJOUB - avatar
+ 1
if your question concerns the image slider of the js corse of soloLearn it is relativly simple. All the images path are loaded in an array, so each path get an index. When you click next the index is incremented and the .src get the path of that index.
21st Sep 2016, 12:30 AM
ADEL MAHJOUB
ADEL MAHJOUB - avatar