How to Create Image Slider in HTML, CSS & JS - Step by Step | JavaScript Projects

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • In this video, learn How to Create an Image Slider in HTML, CSS & JS - Step by Step | JavaScript Projects. Find all the videos of the JavaScript Projects in this playlist: • JavaScript Project Ser...
    💎 Get Access to Premium Videos and Live Streams: / @wscubetech
    WsCube Tech is a leading Web, Mobile App & Digital Marketing company, and institute in India.
    We help businesses of all sizes to build their online presence, grow their business, and reach new heights.
    👉For Digital Marketing services (Brand Building, SEO, SMO, PPC, SEM, Content Writing), Web Development and App Development solutions, visit our website: www.wscubetech...
    👉Want to learn new skills and improve existing ones with in-depth and practical sessions? Enroll in our advanced online courses now and make yourself job-ready: courses.wscube...
    All the courses are job-oriented, up-to-date with the latest algorithms and modules, fully practical, and provide you hands-on projects.
    👉 Want to learn and acquire skills in English? Visit WsCube Tech English channel: bit.ly/2M3oYOs
    📞 For more info about the courses, call us: +91-7878985501, +91-9269698122
    ✅ CONNECT WITH THE FOUNDER (Mr. Kushagra Bhatia) -
    👉 Instagram - / kushagrabhatiaofficial
    👉 LinkedIn - / kushagra-bhatia
    Connect with WsCube Tech on social media for the latest offers, promos, job vacancies, and much more:
    ► Subscribe: bit.ly/wscubech...
    ► Facebook: / wscubetech.india
    ► Twitter: / wscubetechindia
    ► Instagram: / wscubetechindia
    ► LinkedIn : / wscubetechindia
    ► TH-cam: / wscubetechjodhpur
    ► Website: wscubetech.com
    -------------------------------------| Thanks |--------------------------
    #JavaScript #JavaScriptProjects #ImageSlider

ความคิดเห็น • 145

  • @user-yt9pf7kw7u
    @user-yt9pf7kw7u 10 หลายเดือนก่อน +10

    VERY GOOD EXPLANATION, no destructive music, clear voice no jargon, no beating around the bush straight to the point every line explained THANK YOU VERY MUCH.

  • @MaanIsMe
    @MaanIsMe ปีที่แล้ว +30

    It's was easy😅, just takes a little thinking.
    const goNext = () => {
    if (counter < slides.length - 1) {
    counter++;
    slideImage();
    }
    };
    const goPrev = () => {
    if (counter != 0) {
    counter--;
    slideImage();
    }
    };

    • @Himanshua09
      @Himanshua09 ปีที่แล้ว

      I did the same as shown in video but I am getting error.
      When I checked in console it is showing slides.forEach is not a function.
      Please help

    • @CodeWithMaahzaib1
      @CodeWithMaahzaib1 3 หลายเดือนก่อน

      Yeh tw Galat code hai try kia but hua he nahi😊

    • @geeksrahul
      @geeksrahul 2 หลายเดือนก่อน +1

      @@Himanshua09 make sure you used querySelectorAll() not querySelector()

  • @MuhammadWaqas-eb1uu
    @MuhammadWaqas-eb1uu 3 หลายเดือนก่อน +1

    This project help me. And I create with help of slider automatically slide prev and Next.
    Thanks Sir!

  • @adeebkhan8531
    @adeebkhan8531 ปีที่แล้ว +22

    Following changes must be done in 'goPrev' and 'goNext' functions to fix this BUG:
    const goPrev = () => {
    if (counter == 0) {
    counter = slides.length - 1;
    slideShow();
    } else {
    counter--;
    slideShow();
    }
    }
    const goNext = () => {
    if (counter == slides.length - 1) {
    counter = 0;
    slideShow();
    } else {
    counter++;
    slideShow();
    }
    }

    • @saquibansari7866
      @saquibansari7866 ปีที่แล้ว

      Thanx buddy

    • @Himanshua09
      @Himanshua09 ปีที่แล้ว

      I did the same as shown in video but I am getting error.
      When I checked in console it is showing slides.forEach is not a function.
      Please help

    • @zaryabimran7303
      @zaryabimran7303 11 หลายเดือนก่อน

      Can anyone tell me how he hoisted arrow function (slideImage()) 🤔🤔🤔

    • @thesocialtok
      @thesocialtok 10 หลายเดือนก่อน

      use array from() method to fix this foEeach loop error@@Himanshua09

    • @MajorInflation
      @MajorInflation 10 หลายเดือนก่อน

      OKAY I HAVE BEEN TRYING TO RECREATE THIS WITH A DIFFERENT FUNCTION AND IT DID NOT WORK I AM LOSING MY MINF BUT THANKS FOR THIS CODE I AM SO DAMN GRATEFUL BECAUSE I HAVE A WEBSITE TO MAKE AND SUBMIT IN 5 DAYS FOR A PROJECT AND I HAVE BEEN STUCK AT MAKING THIS CARSOUEL FOR 2 DAYS BECAUSE MY JAVA SCRIPT IS BAD HOWEVER I KNOW THAT YOU DON'T CARE SO THANKS THANKS THANKS THANKS THANKS ALSO THANKS TO THE VIDEO MAKER GUY FOR THE OG CODE CUZ I DON'T KNOW JS THAT WELL AND UR EXPLAINATION WAS GREAT OKAY IM RUNNING OUTTA TIME BY THANKS THANKS THANKS THANKS THANKS THANKS THANKS THANKS THANKS THANKS THANKS THANKS THANKS

  • @strangequard5702
    @strangequard5702 5 หลายเดือนก่อน +3

    function gonext() {
    if(count == 3){
    return
    }
    count++
    slider()
    }
    function gopreview() {
    if(count == 0){
    return
    }
    count--
    slider()
    }

  • @srinivasaraoyp3640
    @srinivasaraoyp3640 ปีที่แล้ว +2

    Aapka explain karnay ka tarika bahuth badiya. Thank you very much.

  • @sajadhamid2000
    @sajadhamid2000 ปีที่แล้ว +7

    My favourite tutor on internet

  • @krishnaghosh8393
    @krishnaghosh8393 ปีที่แล้ว +5

    This is a very very helpful video
    Thanks for sharing

  • @kinzasheikh-xn9oe
    @kinzasheikh-xn9oe 5 หลายเดือนก่อน +2

    const slides = document.querySelectorAll(".slide")
    var counter = 0;
    slides.forEach(
    (slide, index) =>{
    slide.style.left = `$(index * 100)%`
    }
    )
    const goPrev = () =>
    {
    counter--
    slideImage()
    }
    const goNext = () =>
    {
    counter++
    slideImage()
    }
    const slideImage = () =>
    {
    slides.forEach(
    (slide) => {

    slide.style.transform = `translateX(-${counter * 100}%)`
    }
    )
    }

  • @FrameFablesTV
    @FrameFablesTV 6 หลายเดือนก่อน +1

    Excellent Explanation Sir!!!

  • @sumitgupta7419
    @sumitgupta7419 ปีที่แล้ว +3

    Thanks sir please keep making video and explaining everything very neatly step by step

  • @SurajMule-i8o
    @SurajMule-i8o หลายเดือนก่อน

    Wa wa wa kya teaching mja aa gya ❤❤ 1 no sir 🎉

  • @jokieme1184
    @jokieme1184 2 ปีที่แล้ว +6

    Sir please make a video on responsive nav bar

  • @hammadrehmani2666
    @hammadrehmani2666 ปีที่แล้ว +3

    great job brother...its very helpful for me

  • @OneXHacker001
    @OneXHacker001 9 หลายเดือนก่อน

    best javascript playlist which have helped me in getting a grip on javascript.

  • @Chain25
    @Chain25 9 หลายเดือนก่อน

    Welcome and Thanks a Lot.

  • @gaurangmore9413
    @gaurangmore9413 ปีที่แล้ว +2

    thanks a lot buddy,this video really saved my ass.

  • @Shahid-zt7mg
    @Shahid-zt7mg ปีที่แล้ว +1

    This is really very very very helpful for me using this concept I make better the my UI

  • @omprakashsuthar7218
    @omprakashsuthar7218 ปีที่แล้ว +1

    This is a very helpful video.
    Thanks sir

  • @harisrehman7090
    @harisrehman7090 ปีที่แล้ว +2

    REALLY HELPFULL THANKU!❣

  • @VishalSharma-rn7mt
    @VishalSharma-rn7mt 6 หลายเดือนก่อน

    Awesome, very clear and easy

  • @samandartursunov7205
    @samandartursunov7205 5 หลายเดือนก่อน +1

    Thanks bro )

  • @MienVuThi-uf9hf
    @MienVuThi-uf9hf ปีที่แล้ว +2

    great video

  • @crazytthings47
    @crazytthings47 8 หลายเดือนก่อน +7

    Sir this video help me a lot but meko js bilkul nhi samajta😢

    • @CrazyvlogsH
      @CrazyvlogsH 5 หลายเดือนก่อน +3

      Js apko nhi smjhega apko js ko smjhna pdega😂

  • @Rahmanullah-iu9tf
    @Rahmanullah-iu9tf ปีที่แล้ว +2

    sir this is very helpful

  • @yashghugardare519
    @yashghugardare519 ปีที่แล้ว +1

    very helpfull

  • @shivam3839
    @shivam3839 ปีที่แล้ว

    this series was pretty helpful, now i am comfortable in javascript

    • @Himanshua09
      @Himanshua09 ปีที่แล้ว

      I did the same as shown in video but I am getting error.
      When I checked in console it is showing slides.forEach is not a function.
      Please help

    • @shivam3839
      @shivam3839 ปีที่แล้ว

      @@Himanshua09
      const slides=document.querySelectorAll('.slide')
      let counter=0
      slides.forEach((slide,index)=>{
      slide.style.left=`${index*100}%`
      })
      const slideImage=()=>{
      slides.forEach((slide)=>{
      slide.style.transform=`translateX(-${counter*100}%)`
      })
      }
      const goNext=()=>{
      counter++
      if(counter>3)
      counter=3
      slideImage()
      }
      const goPrev=()=>{
      counter--
      if(counter

    • @zaryabimran7303
      @zaryabimran7303 11 หลายเดือนก่อน

      @@Himanshua09 console and check that have you selected all the slides in the slide variable ...

    • @pankaj_9998
      @pankaj_9998 9 หลายเดือนก่อน

      @@Himanshua09 check slides is array of images items or not.

  • @fightforfitness2256
    @fightforfitness2256 ปีที่แล้ว

    Very nicely explained sir.

  • @talibhusain3335
    @talibhusain3335 ปีที่แล้ว +1

    Nice explanation

  • @akhilch3684
    @akhilch3684 ปีที่แล้ว +1

    Wow great explanation

    • @Himanshua09
      @Himanshua09 ปีที่แล้ว

      I did the same as shown in video but I am getting error.
      When I checked in console it is showing slides.forEach is not a function.
      Please help

  • @harikyt
    @harikyt 11 หลายเดือนก่อน

    awesome...bohot sahi

  • @Ranaali069
    @Ranaali069 หลายเดือนก่อน

    nice

  • @randykeetley9780
    @randykeetley9780 10 หลายเดือนก่อน +2

    I did exactly what you did, and I even made sure that I did by checking my code. However, when I hit the next and previous buttons, you can tell they are being pressed however, the images don’t change at all

    • @hassansmma
      @hassansmma 9 หลายเดือนก่อน

      check again with zoom

    • @NexusVisions164
      @NexusVisions164 9 หลายเดือนก่อน

      Same issue, did you find any solution?

    • @Poojayadav-zm1hq
      @Poojayadav-zm1hq 9 หลายเดือนก่อน +1

      Yes even I got this issue, images doesn't change after clicking next and prev

    • @Vikrant_Dubey
      @Vikrant_Dubey 7 หลายเดือนก่อน +1

      slide.style.transform = `translateX(-${counter * 100}%)`; may be in this line you are using single quotes use tilde copy paste this code line

    • @anjalimishra455
      @anjalimishra455 7 หลายเดือนก่อน

      ​@@Vikrant_DubeyI ha have same issue 😔 Maine check Kiya to console me error hai goNext is not defined at HTMLbuttonElement.onclick aa raha hai please help 😢

  • @skygrace8459
    @skygrace8459 2 ปีที่แล้ว +1

    Excellent, thank sir.
    Would you please make autoplay list

  • @Dev-Phantom
    @Dev-Phantom 2 ปีที่แล้ว +1

    easy to understand

    • @zaryabimran7303
      @zaryabimran7303 11 หลายเดือนก่อน

      Can anyone tell me how he hoisted arrow function (slideImage()) 🤔🤔🤔

  • @abhinavyadav6821
    @abhinavyadav6821 2 ปีที่แล้ว +5

    Sir pls make video on ping pong game by javascript , pleaseee sir it will be very helpful

  • @_justacoder_
    @_justacoder_ ปีที่แล้ว +1

    Loved it!! you made it super easy to understand

  • @ashutoshswain6206
    @ashutoshswain6206 ปีที่แล้ว +3

    Dear sir, Thanks for this type of video but please provide it's source code

  • @nehaartgallery6319
    @nehaartgallery6319 หลายเดือนก่อน

    What level of project should we done for internship

  • @advanbhatti6063
    @advanbhatti6063 ปีที่แล้ว +1

    Big fan

  • @NANIANTIC
    @NANIANTIC 2 หลายเดือนก่อน

    const prev = () => {
    if (counter > 0) {
    counter--;
    slideimg();
    }
    }
    const nxt = () => {
    if (counter < slides.length - 1) {
    counter++;
    slideimg();
    }
    }

  • @mystudy6114
    @mystudy6114 2 ปีที่แล้ว +1

    Please make a separate playlist for this

  • @imihere5103
    @imihere5103 2 ปีที่แล้ว +3

    Sir me ne fiverr pe six months pehly account bnaya tha, kisi waja se kam start na kr ska, WordPress se related gigs bnai thi
    Now i want to start freelancing again because im free now
    Pochna just ye he k muje new account bnana chahye ya wohi purana account
    Agr wohi account use kru to kya customer ko ye ni lge ga k is ne to six months se ak b order complete ni kya, customer negative ni ho jay ga? Pls guide me

    • @abhishektiwari2643
      @abhishektiwari2643 2 ปีที่แล้ว +2

      Freelancing me kya karna hota hai
      Kya programing language aana chahiye
      Esme kya karna hota hai
      Kya kya aana chahiye

  • @lyrichives7859
    @lyrichives7859 11 หลายเดือนก่อน

    Thank youuu

  • @manishpanchal1098
    @manishpanchal1098 2 ปีที่แล้ว +1

    nice video

  • @itskishorstatus962
    @itskishorstatus962 ปีที่แล้ว +1

    Sir can you please make it infinite.that after last image first image will run.

  • @mahadevmushrooms
    @mahadevmushrooms ปีที่แล้ว +2

    mere hisab se bright theme better hai

  • @026maheshkumars7
    @026maheshkumars7 10 หลายเดือนก่อน

    super

  • @nikitashirke6025
    @nikitashirke6025 2 ปีที่แล้ว

    Superb

  • @integrate2945
    @integrate2945 ปีที่แล้ว +1

    Could you please provide some php project????? Please....

  • @hello_Subham
    @hello_Subham ปีที่แล้ว +1

    please send us logic that empty box which is not found in the github link I really need that code ..

  • @beinglearner8543
    @beinglearner8543 3 หลายเดือนก่อน

    Error Index is not recognize
    const slides = document.querySelectorAll(".slide")
    var counter = 0;
    console.log(slides)
    slides.forEach(
    (slide,index) => {
    slide.style.bottom = '${index * 100}%'
    }
    )
    index Error

  • @nitishkumar4633
    @nitishkumar4633 ปีที่แล้ว +1

    Sir where this code is available, may you please provide the link?

  • @visheshkumar8015
    @visheshkumar8015 ปีที่แล้ว +4

    Can use this for the first the slide after last slide
    translateX(-${(counter%4)*100}%)

    • @listenbeautiful9512
      @listenbeautiful9512 ปีที่แล้ว

      Yes bro...👍

    • @aftabshaikh305
      @aftabshaikh305 11 หลายเดือนก่อน +1

      bro but in my laptop this ${} does not work i dont know why

  • @parthdashore46
    @parthdashore46 ปีที่แล้ว

    clean

  • @manishagurjar9058
    @manishagurjar9058 ปีที่แล้ว +1

    my javascript code is not working plz share the code.

  • @Arbazbabu033
    @Arbazbabu033 5 หลายเดือนก่อน

    Jquery se slick skider kese lagaye

  • @nishagawade3248
    @nishagawade3248 ปีที่แล้ว +2

    why do we need to write slide image function twice?

    • @avishekadhikary3677
      @avishekadhikary3677 ปีที่แล้ว

      Coz first we have to arrange the images in a systematic way, in a line. Then we have to slide those images on that line of images.
      In these case the first slide function arranges the images and the second one is the function for the slider
      Hope these helps 🙂✊

    • @Himanshua09
      @Himanshua09 ปีที่แล้ว

      I did the same as shown in video but I am getting error.
      When I checked in console it is showing slides.forEach is not a function.
      Please help

  • @zaryabimran7303
    @zaryabimran7303 11 หลายเดือนก่อน +1

    Can anyone tell me how he hoisted arrow function (slideImage()) 🤔🤔🤔

    • @vasudevpareek2862
      @vasudevpareek2862 11 หลายเดือนก่อน

      const slideImage = ( ) => {
      //code for functions
      }

  • @digitalaayam2503
    @digitalaayam2503 2 ปีที่แล้ว

    Ye example to automatically chalta hai bro, however, good job

  • @peculiar_psa
    @peculiar_psa 2 หลายเดือนก่อน

    bhai kiska ye transition effect aa rah hai kya ?? mera pata nhi kyu sirf image change ho raha hai but transition me slide nhi ho rah!

  • @TusharKumarPatel-ns1lo
    @TusharKumarPatel-ns1lo 9 หลายเดือนก่อน

    I tried it as it is but not working

  • @manojrawat5756
    @manojrawat5756 ปีที่แล้ว +1

    ❤❤❤

  • @BRAND_OF_UTTARPRADESH
    @BRAND_OF_UTTARPRADESH 8 หลายเดือนก่อน

    Please avoid text display on screen at code editor page

  • @RamChander-ng1de
    @RamChander-ng1de 2 ปีที่แล้ว

    Sir kon s theam use karte hoo in vs code

  • @bhumikasethi7175
    @bhumikasethi7175 18 วันที่ผ่านมา

    Not working

  • @rajputfitness8641
    @rajputfitness8641 ปีที่แล้ว +1

    how to make this auto change😅

  • @phpmysql2518
    @phpmysql2518 2 ปีที่แล้ว +1

    where is your github link

  • @kholoudbelhadj
    @kholoudbelhadj 10 หลายเดือนก่อน

    how can I make them switch automatically

  • @Lyrics_Editz2005
    @Lyrics_Editz2005 2 หลายเดือนก่อน

    Sir iska source code kha Mila ga

  • @gkandcurrentaffairs7151
    @gkandcurrentaffairs7151 10 หลายเดือนก่อน

    if you provide source code then it will easy bro

  • @avinashhemanth4145
    @avinashhemanth4145 ปีที่แล้ว +1

    in script code why this is not working for me
    slides.forEach(
    (slide,index) =>{
    slide.style.left=`$(index*100)%`
    }
    )

    • @brijeshpoojary1791
      @brijeshpoojary1791 ปีที่แล้ว

      It's brackets should be changed to
      ${index*100}%

    • @avinashhemanth4145
      @avinashhemanth4145 ปีที่แล้ว

      @@brijeshpoojary1791 kk thnks

    • @saquibansari7866
      @saquibansari7866 ปีที่แล้ว

      After dollar sign use curly braces {}, not parenthesise (), while using template literal...

  • @Irshadali121-ng6rr
    @Irshadali121-ng6rr ปีที่แล้ว +1

    Slide end kaise hoga

  • @priyamittal8302
    @priyamittal8302 3 หลายเดือนก่อน

    source code?

  • @_justacoder_
    @_justacoder_ 11 หลายเดือนก่อน

    where is the link for source code

  • @banihin
    @banihin ปีที่แล้ว

    I cannot use .style.left or .style.transform. There seems to be an error with the "slide" variable but I've followed every step.

  • @nabilaakhtar818
    @nabilaakhtar818 9 หลายเดือนก่อน

    Where is the github link?

  • @ManmohanBhardwaj-ft2hu
    @ManmohanBhardwaj-ft2hu ปีที่แล้ว

    Sir code not working

  • @alilatif2467
    @alilatif2467 2 ปีที่แล้ว

    ❤️❤️❤️❤️

  • @Devyadav0007
    @Devyadav0007 3 หลายเดือนก่อน

    Ye Jo aap bolte h to likh jata h isse kafi dikkat hoti h

  • @mdirshadkhan6124
    @mdirshadkhan6124 ปีที่แล้ว +1

    Can you share code of this image slider

    • @MUHAMMADUMAR-fe7ec
      @MUHAMMADUMAR-fe7ec ปีที่แล้ว +1

      ye tatto hai nai kare ga

    • @bollybuck
      @bollybuck ปีที่แล้ว

      @@MUHAMMADUMAR-fe7ec yr img slider ki koi range hi ni h
      Back krty rho hota rhy ga

    • @MaanIsMe
      @MaanIsMe ปีที่แล้ว +1

      Here you go,
      const goNext = () => {
      if (counter < slides.length - 1) {
      counter++;
      slideImage();
      }
      };
      const goPrev = () => {
      if (counter != 0) {
      counter--;
      slideImage();
      }
      };

  • @Rameshpuri81
    @Rameshpuri81 ปีที่แล้ว

    " 0 * 100 " = zero "0" hota h sir ,"1*100"= 100 hota h sir

  • @advanbhatti6063
    @advanbhatti6063 ปีที่แล้ว

    Sir g me ne like subscribe or share kr ke apni fee pay krdi hy

  • @aarushirajput7821
    @aarushirajput7821 ปีที่แล้ว

    translate spelling mistake😅

  • @MuntasirMamunRony
    @MuntasirMamunRony 9 วันที่ผ่านมา

    sir pehle haddi to banalo fir style lagana!

  • @scriptpriest
    @scriptpriest 11 หลายเดือนก่อน

    What if we want the image slider to be like a wheel. So that when you click on the next button after the last image, the slider still slides forward but shows the first image instead of sliding backwards to the first image.
    And vice versa

    • @pankaj_9998
      @pankaj_9998 9 หลายเดือนก่อน

      i was also looking solution for this case

    • @its_adesh
      @its_adesh 7 หลายเดือนก่อน

      Use modulo on counter

  • @vasudevpareek2862
    @vasudevpareek2862 11 หลายเดือนก่อน

    the code is not working 😕

    • @harikyt
      @harikyt 11 หลายเดือนก่อน +1

      it is working for me

  • @apaarjain
    @apaarjain 20 วันที่ผ่านมา

    Waste of time. Incomplete

  • @rb.rana1993
    @rb.rana1993 2 ปีที่แล้ว +1

    Sir please give this projector source code or GitHub link

  • @Himanshua09
    @Himanshua09 ปีที่แล้ว

    I did the same as shown in video but I am getting error.
    When I checked in console it is showing slides.forEach is not a function.
    Please help

    • @kumaxFPS
      @kumaxFPS ปีที่แล้ว

      check in console, u may not be assigning the images in slides variable.

    • @kumaxFPS
      @kumaxFPS ปีที่แล้ว

      alos check JS connection

  • @Lets_develop_it
    @Lets_develop_it ปีที่แล้ว

    here is the solution for this bug
    function Prev() {
    if (counter == 0) {
    } else {
    counter++
    slideimage()
    }
    };
    function Next() {
    if (counter == (slides.length*-1)+1) {
    } else {
    counter--
    slideimage()
    }
    }

    • @scriptpriest
      @scriptpriest 11 หลายเดือนก่อน +1

      What if we want the image slider to be like a wheel. So that when you click on the next button after the last image, the slider still slides forward but shows the first image instead of sliding backwards to the first image.
      And vice versa

  • @chunmunjain3490
    @chunmunjain3490 ปีที่แล้ว +1

    my javascript code is not working plz share the code

  • @MrJayantchaudhary
    @MrJayantchaudhary ปีที่แล้ว

    Sir can you please make it infinite.that after last image first image will run.