Skip to main content

How to Create Slideshow using JavaScript ?

How to Create Slideshow using JavaScript?




In this blog I am wiritng about slider (webiste slideshow) . You can implement this using javascript. Implementing this unig javascript is very easy. You can do this using CSS only but that is bit difficult. In this tutorial I am creating two button next and previous and when you clcik n that image changes.

First understand that How slider works ?

Slider basically works on hiding one image and showing the next image. So we have to write a function which hides an image and show another image.
Just look after line number 79

Now after looking at function you got some idea that I am hiding one image and shoing other image.
I had created a global variable where I store current Active image and use that variable to hide the current image.
After hiding current image I update the value of that If the function is next() then I add +1 and if the function is pre() then I -1 from that variable.

After hiding and updating there is one more step that new value is valid or not.
Valid ?
Yes, Valid because suppose going next and next we reach the last image and when we click on next nothing is showing. So, for that, we need to verify that new variable(after updating) should be within the range of children of ul.

I hope you understand this tutorial 

Comments

Popular posts from this blog

Some YouTube channel which every Programmer must Subscribe

Some YouTube channel which every Web Programmer must Subscribe Hitesh Chaudhary Hitesh Chaudhary is Awesome Youtuber as well as a programmer. He  share video very frequently, his video is mostly about tech talks. You should Subscribe his channel to get some latest technologies News. Travesy Media Traversy Media's guy is awesome Youtuber as well as excellence  Mentor at UDEMY. He mostly shares a preview video of his Udemy Course Video. His youtube videos are preview part of Udemy Complete Course but his preview is really a lot to understand and start working on that technology. He is the very Creative guy, he always creates some product in his tutorial. The Coding Train He is best because he mostly does challenging work within some time limit during youtube video. He is Professor. He mainly works on p5,js and implements everything using p5.js .like Game, Machine Learning, Fireasbe etc. Siraj Rava He is almost same as Shiffman (The Coding T...

How to setup Firebase ?

How to Setup Firebase in WEB Step 1 :   Download NodeJS  (LTS) and Install it. You can download any from these two . I'll suggest you to go with 8.9.3 LTS . Step 2 : Install Firebase CLI npm install -g firebase-cli Step 3 : Open Command Prompt and Login to Firebase. firebase login Step 4 : Initialise Firebase App in the desired directory firebase init Step 5 : Deploy Your Project firebase deploy