HTML, CSS, JavaScript Carousel Tutorial Step by Step - JavaScript Tutorials for Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • In today's tutorial, I'll walk you through the entire process of building a JavaScript slider or carousel from scratch, making it an ideal guide for JavaScript beginners. While many developers opt for ready-made libraries to construct a JavaScript carousel, the truth is, you don't need to rely on third-party solutions; you can easily build one yourself using just HTML, CSS, and JavaScript. Within a span of just 30 minutes, I was able to assemble a functional carousel, complete with sleek transitions and responsive design. For those interested in incorporating an auto-play feature, I'll demonstrate how to utilize JavaScript's setInterval function to automatically transition between slides at set intervals. This comprehensive video tutorial is targeted at JavaScript beginners and is a part of my ongoing series focusing on fundamental JavaScript projects. So whether you're a web development freelancer, embarking on a web designer career, or simply eager to expand your web development skill set, this video will provide you with valuable insights and a hands-on approach to coding. Stay tuned for more content aimed at beginners, as I'll continue to produce in-depth tutorials that explore the basics of JavaScript, as well as other popular frameworks like React. Subscribe now to not miss out on upcoming web development courses and tutorials!
    🛠️ What You'll Learn: You'll discover that while many folks opt for ready-made libraries for JavaScript carousels, creating one yourself is not as daunting as it sounds.
    🕒 Time Investment: I managed to assemble a fully functional carousel in less than 30 minutes.
    ⚙️ Auto-Play Feature: If you're interested in adding an auto-play feature 🔄, I'll guide you through using JavaScript's setInterval function, which allows the carousel to automatically switch slides at set intervals.
    👨‍💻 Target Audience: Whether you're a web development freelancer, venturing into a web designer career 🎨, or simply keen to boost your web development skills 📈, this video will serve you well.
    📚 More Content: I'll be focusing on pure JavaScript essentials for upcoming videos, so we won't only touch on frameworks like React.
    #ImageSlider #JavascriptTutorialForBeginners #JavascriptSliderTutorial #JavascriptSliderTutorialStepByStep #JavascriptTutorialForBeginnersFullCourse #WebDevelopmentFreelance #WebDesignerCareer #HtmlCssBootstrapWebsiteDesignTutorial #ImageSliderHtmlAndCssJavascript #LearnToCodeJavascriptForBeginners #WebsiteDesignBasicsForBeginners #JavascriptProjectsForBeginners #WebDeveloperDayInTheLife #LearnToCodeForFree #WebDevelopmentCourse
    ✅ Subscribe for more developer tips and tricks: bit.ly/Cogniti...
    🐦 Stay in the loop on Twitter: / karlhadwen
    🖼️ Code: github.com/kar...
    🔥 Support the channel by becoming a member: / cognitivesurge
    👍 Liked the video?
    - Give it a thumbs-up 👍
    - Share it with your network 🌐
    - And don’t forget to SUBSCRIBE for more top-notch developer content! 🔔
    🙏 Thanks for tuning in! See you in the next episode where we continue to make tech easy and accessible for everyone! ✌️

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

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

    🔥 Support the channel by becoming a member: th-cam.com/users/CognitiveSurgejoin
    ✅ Please remember to Subscribe: bit.ly/CognitiveSurge

    • @frankorlando3794
      @frankorlando3794 3 ปีที่แล้ว

      pro tip : watch movies at Flixzone. Been using it for watching a lot of movies during the lockdown.

    • @larryalan3078
      @larryalan3078 3 ปีที่แล้ว

      @Frank Orlando yea, I have been using Flixzone} for months myself =)

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

    This feels more like programming, the thoughts and confusions while coding, best tutorials

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

    The only thing I regret is that I did not find your channel earlier. Thank you for actually explaining something rather that just reading what you have wrote.

  • @user-gu7vr2wl2s
    @user-gu7vr2wl2s 3 ปีที่แล้ว +2

    thank you SO MUCH for this tutorial... I am taking JS course and my homework was creating carousel, and I had to idea how to do this... I've watched dozen of videos on youtube in Russian, English and Polish but all of them were too complicated and above my level, but yours is just PERFECT, thanks to you I've learned how to to it! and your way of teaching.. its different from other youtubers, but its a better one, because when you think what code to write next, it makes the viewers on the other side of the screen instinctively to think together with yout, not just blindly watching your work. good job!

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Thanks mate, appreciate that :) Glad you got your homework done :D

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

    After a long search in youtube I found your video i after the video I just subscribed

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

    Amazing stuff Karl! really love how you brainstorm to overcome those problems👏🏼🔥

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

    Great man, I couldn't find any video with carousel slider button, you are a lifesaver! Thanks

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

    Great tutorial with great explanations! Good idea of making more plain JS tutorials in the future ;) Thanks man

  • @ben-cb5er
    @ben-cb5er 3 ปีที่แล้ว +3

    Not sure what sort of content you normally do but this video made me subscribe! Awesome video.. Hope you do more css and js 🤘

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Thanks! Definitely, I want to do more videos around just HTML & CSS. Next week I'll be uploading a simple HTML, CSS video.

  • @user-zz3gw4id5j
    @user-zz3gw4id5j 2 หลายเดือนก่อน

    Thanks a lot for this video, I know that is 2024 but I could learn deeper this topic.

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

    this is a very good tutorial, the way you explain what the code is going to do before you even try it, makes me like this tutorial more.
    Also the thing that you wrote it WHILE doing the tutorial instead of pre-coding it before and than doing it without any mistakes in the video... idk man THANKS, KEEP IT UP!!!!

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

    Thank you so much, the best carousel tutorial I've found

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

    This helped me unlike the other tutorials, thankyouu

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

    Great explaining, especially on the css.

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

    This helped me tremendously with a homework from a JS course, you're the true MVP! Thanks a lot!

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

    Although this was not what I was looking for, this was a great tutorial and it works so I can't ask for more.

  • @FC-rs7ro
    @FC-rs7ro 2 ปีที่แล้ว +1

    its a best video becasue of the explanation , plz keep going

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

    I struggle with making something similar. You saved me time and life

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

    This was super helpful! Thanks So Much!

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

    Top man! JS can be a nightmare to get your head round sometimes so this vid was really helpful for a beginner

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

    awesome tutorial, thank you! its my first time creating a project using react and was able to make it all happen within a jsx file

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

    This is a down to earth and very easy to understand tutorial on the subject, thanks for this 👍

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

    Your video helped a lot! Many thanks!

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Glad I could help, thanks Suzana!

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

    Thank you for your video! it was easy to follow and you were thorough with every step.

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Appreciate that, thanks Crisley!

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

    you did great, dude! this is so nice, thanks for sharing.. you helped me grow. :'D you got another sub.

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

    very clear bro. Thanks so much

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

    Easy and Perfect!

  • @AngelSanchez-wh1rd
    @AngelSanchez-wh1rd ปีที่แล้ว

    Thank you 🙏 i needed this information

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

    thanks man.. it's really helping..

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

    Bless this man

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

    Awesome tutorial!

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

    Thanks bro, heres a comment and a like

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

    LEGENDICE

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

    06:19 I noticed that it will actually be unnecessary to add `.carousel .carousel__item--hidden` since you never had it included in HTML. I deleted it from css and js and it still worked fine.
    22:40
    function updateSlidePosition() {
    for (let slide of slides) {
    slide.classList.remove('cell-visible');
    slides[slidePosition].classList.add('cell-visible');
    }
    }
    Also thank you for the video! I didn't realize how simple it was to create a carousel. I've looked everywhere for a video like this!

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Thanks for pointing that out! I always end up leaving stuff in projects that I thought I'd need, but never do. It's not that hard is it? It seems hard but when you get to grips with the inner working of the carousel, it's not too bad :)

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

    thank you for this tutorial

  • @GustavoSilva-ut3cp
    @GustavoSilva-ut3cp 2 ปีที่แล้ว

    Thank you very much! :)

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

    Amazing, It's more like learning together ☺☻♥🧠

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

    thank you for the great tutorial! really help with my project!!

  • @M.Hussein500
    @M.Hussein500 2 ปีที่แล้ว +1

    tremendous help! thank you!
    but, how do I get the carousel to be in the center of my screen? sorry I'm very new to this

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

      Wrap it in a div and center the main div

  • @paulblack2649
    @paulblack2649 3 ปีที่แล้ว

    Great tutorial and great explanations. Thanks

  • @castlemoyle
    @castlemoyle 3 ปีที่แล้ว

    Seems like a really good video. I was enjoying your thinking through the JS, but after the 6 commercial in the first 20 minutes, I had to give up.

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

    Nicely done great job

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

    good job man

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

    In a professional setting, would you ever actually use vanilla JS to create something like this (image carousels, sliders etc) or would it all be done with frameworks/component libraries?

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

      Depends on the company, but you'd want to be consistent I'd imagine so it'd be good to have something like this in a component library. When I worked at Sky, we built our own and put it into a component library.

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

    Thank you very much ....

  • @esraamismail7557
    @esraamismail7557 3 ปีที่แล้ว

    thank you very much, what about the three points which were under the carousel ?!
    how can I relation it with the image

  • @zelalemyemaneh3597
    @zelalemyemaneh3597 3 ปีที่แล้ว

    tanks

  • @vstone408
    @vstone408 3 ปีที่แล้ว

    How would you incorporate the auto-play feature? Thanks for all your help

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      use a timer, maybe setTimeout to just autoplay?

  • @raghavjindal2414
    @raghavjindal2414 3 ปีที่แล้ว

    What is the font name that u applied to vs code?

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

    cool now for react js version maybe?

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

      I could do? Would be much easier...

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

    Do you at any point show the completed project? And using just 3 images?

  • @Amir-ku5lp
    @Amir-ku5lp 3 ปีที่แล้ว

    Why didn't you set padding for carousel__actions which is the container of buttons instead of applying margin to each button individually ?! 12:47

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Because then it adds unnecessary margin and my OCD wouldn't like that ;)

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

    ❤️❤️❤️❤️sir, shoping cart tutorials

  • @oneofone_1333
    @oneofone_1333 3 ปีที่แล้ว

    Cool video!! Which vscode theme did you use here?

  • @krax8513
    @krax8513 3 ปีที่แล้ว

    Nice vid but at the end I get an error : "Uncaught TypeError: slides[slidePosition] is undefined"
    It does that everytime i have to get back to the beginning from the last slide (by clicking next) or from the first to the last one (by clicking previous). Any idea ?

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Can you check the repo and see how your code differs to the one shown in the tutorial?

    • @krax8513
      @krax8513 3 ปีที่แล้ว

      @@CognitiveSurge the thing is that it doesn't seem to differ at all... That's not a big deal but still

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

    Brother whats the vscode theme name?

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

    cool

  • @aliothcarsyn3952
    @aliothcarsyn3952 3 ปีที่แล้ว

    Hello, for some reason all of the code was working until I got to the JavaScript part. is there something that I need to install for java to run in visual studio? I even went ahead and copy and pasted your app.js code and index.html to triple check and its STILL not even working? May you please help?

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      What errors are you seeing in console?

    • @aliothcarsyn3952
      @aliothcarsyn3952 3 ปีที่แล้ว

      @@CognitiveSurge There were no errors, That’s why I am confused I’m assuming that it was a class name error I probably made by misspelling, but that’s why I copied your code, but it still was not working. I can email you if you would like?

    • @84music1
      @84music1 3 ปีที่แล้ว

      @@aliothcarsyn3952 Did you link your .js file on your index.html? You shouldnt need anything within VS code to run the javascript.

  • @bryandelacruz9066
    @bryandelacruz9066 3 ปีที่แล้ว

    Hi is this responsive? thanks

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Hmm, I can't remember xD but it should be fairly easy to make this responsive

  • @CurioClipsshow
    @CurioClipsshow 3 ปีที่แล้ว

    But
    How to make sure it doesn't end

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Do a check to see if you're at the end and disable the right button. I'd check the length of the array vs. current position

  • @ziker7185
    @ziker7185 3 ปีที่แล้ว

    how can i make it autoplay please??

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

      try using just a setTimeout to switch it every X seconds

    • @ziker7185
      @ziker7185 3 ปีที่แล้ว

      @@CognitiveSurge thank you

  • @yalla_caguetrades4140
    @yalla_caguetrades4140 3 ปีที่แล้ว

    how do you copy and paste with keyboard?

  • @David-pc5zn
    @David-pc5zn 3 ปีที่แล้ว

    Great bro, what is the name theme vscode?

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      I've forgotten for this :( it might be in the comments, maybe GitHub dark pro

  • @chanbasha3984
    @chanbasha3984 3 ปีที่แล้ว

    How did you take carousel-item---hidden in css.. that's not mentioned in html😟

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Which timestamp? did you get it to work?

    • @chanbasha3984
      @chanbasha3984 3 ปีที่แล้ว

      @@CognitiveSurge at 4:32 in html there is no "courosel__item--hidden" but at 6:22 in css.. 😟 i didn't get that

  • @morhaham6609
    @morhaham6609 3 ปีที่แล้ว

    Pleasure to watch you..Why do you use very high css specificity? like instead using just id's you write the parent class name then the child id and so on..

    • @CognitiveSurge
      @CognitiveSurge  3 ปีที่แล้ว

      Old habits xD I like to be very specific - albeit I don't use IDs at all in my regular work

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

    plz could u share raw code , thank you

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

      github.com/karlhadwen/carousel

  • @camilogarcia1325
    @camilogarcia1325 3 ปีที่แล้ว

    This is a slider, not a carousel. But thanks anyway very useful