How To Create An Animated Image Carousel With CSS/JavaScript

  Рет қаралды 278,986

Web Dev Simplified

Web Dev Simplified

Күн бұрын

Пікірлер
@Free_Bird78
@Free_Bird78 2 жыл бұрын
the fact that you literally don't stop to explain for a bit amaze me. how can you keep explaining without hesitating
@go_sh4627
@go_sh4627 8 ай бұрын
🤣😂🤣
@bader6409
@bader6409 3 ай бұрын
It's crazy how quickly you're not only able to describe but quickly code what's needed to be coded (obviously you may have practiced this before) but you teach well, thanks for this.
@tharunrajoptimus5229
@tharunrajoptimus5229 3 жыл бұрын
You never fail to amaze me. I was watching random stuff and saw this coming. Watched this and I'm sure I won't regret wasting the entire day. Nice video mate.
@frp8392
@frp8392 Жыл бұрын
npc comment
@korokiri8575
@korokiri8575 3 жыл бұрын
hi just found your channel, and just wanted to put it here i've been a front end engineer for the past 2-3 years and i found many little things that i newly learn from the way you write the animation Its amazing ! keep it up
@tumbler9428
@tumbler9428 3 жыл бұрын
Wow... the javascript part would have taken me HOURS. So elegant.
@osamapervezriar387
@osamapervezriar387 Жыл бұрын
I give Kyle's videos a thumbs up right after the window opens, and then i watch the video after. quality work bro. Thanks
@chinmayghule8272
@chinmayghule8272 2 жыл бұрын
I spent the whole evening creating a carousel that isn't even accessible, but he did it so easily. The part I particularly found difficult was to keep the carousel responsive and make sure it looks good on all sizes.
@dhanlitozi184
@dhanlitozi184 2 жыл бұрын
you make something that took me a whole day to make and doing it while talking. that's awesome.
@flyinoctopus
@flyinoctopus 3 жыл бұрын
Another brilliant tutorial, Kyle. I really appreciate you! With your help, I feel like I can truly become a web developer :)
@kakakakaka7955
@kakakakaka7955 Жыл бұрын
funny how you've mentioned that the CSS might have been difficult here, yet the only part that I struggled to fully understand was the JS script :D Thanks, very informative video!
@cocoyana
@cocoyana 2 жыл бұрын
这老哥写得可以,最近在准备亚麻前端的面试,image carousel是常考mini app。如果你也再找类似的solution的话,这个老哥推荐,不要找2021年以前的video了,并不是说BEM写法不好,太繁琐了,这个老哥的coding style很棒,逻辑也很清楚,说得也通俗简单,我没开字幕都全部跟下来了。 This bro did a pretty fantastic job! I have been preparing for the amazon FTE interview recently, and the image carousel is a frequently asked question. If you are also looking for a solution to prepare the interview, don't look up the video earlier than 2021, I mean I watched a couple of videos using the BEM method to name the class, that's a good and popular method developer used before whatever in USA or China, but I think it's too redundant. This bro's coding style is pretty good and his logic is great and explains everything in a concise way. I didn't turn on the English subtitle and can follow up on every step with him.
@mykalimba
@mykalimba 3 жыл бұрын
8:20 I'd be interested in seeing a video/article that elaborates on this. I don't see how working with attributes instead of classes makes working with JavaScript any easier. If anything, it seems like it'd take more effort to do the same thing when using data attributes (e.g. typing attribute "data-blerg" vs. class name "blerg", querySelectorAll('[data-blerg]') vs. querySelectorAll('.blerg'), etc.). Any class name collisions (I think that's what you mean by the term "overlap"?) are avoided by having a good HTML/CSS design ahead of time.
@ShawnRitch
@ShawnRitch 3 жыл бұрын
Now that is funny... I was thinking exactly the same thing - except, I prefer using IDs as they differentiate the use of JS from CSS being used. However, this was still a great video to watch. Kyle does a wonderful job making these for us. :D
@lovefashro
@lovefashro 3 жыл бұрын
@@ShawnRitch Classes are better as you might have multiple carrousels on the page
@justindion4394
@justindion4394 3 жыл бұрын
@@lovefashro I think you could run into the same problem and you end up with data-carousel-button-2 and on
@lovefashro
@lovefashro 3 жыл бұрын
@@justindion4394 i was refering to using classes over ids
@robwatson826
@robwatson826 3 жыл бұрын
One good reason is future maintainability - if you come back to this code in the future and see loads of class names, you could easily be fooled into thinking you have CSS rules to go along with it. Also, a class like “active” is fairly common and could easily overlap with other display styles you have created which could cause odd rendering issues
@bobdinitto
@bobdinitto 3 жыл бұрын
I enjoyed this and learned a lot but I'll have to watch at least seven more times to absorb it all. CSS selectors are my weak point so I'm always interested in learning new selector tricks.
@robertobellotti5941
@robertobellotti5941 2 жыл бұрын
Something that confused me for a moment was how in the html we are adding attributes such as "data-active" or "data-carousel-button", yet in the javascript we are referencing those attributes with the syntax "element.dataset.active" or "element.dataset.carouselButton". I was trying to figure out where the camelCased version of carouselButton came from, but it simply gets translated that way anytime you use "data-something" in the html tag, it will be referenced as element.dataset.something. And apparently if you used multiple dashed words like "data-some-thing-else" then it can be referenced as "element.dataset.someThingElse". Ok sure, though I'd recommend using camelCase in your html tags instead for better clarity. For example and will both be referenced as "element.dataset.someThingElse" in the javascript, so might as well use the camelCase in the html too
@adaravaks
@adaravaks Жыл бұрын
Thank you very much, I was questioning the same thing
@TLPLounge
@TLPLounge Жыл бұрын
its in the html documentation that element.dataset-any-thing converts to anyThing if youre gonna reference it in JS
@michaelparkernorton4841
@michaelparkernorton4841 Жыл бұрын
Thanks this is going to help a lot as I work to complete my homework assignment for Web Dev Fundamentals II at BYUI this week!
@michelaveline
@michelaveline 3 жыл бұрын
In Portuguese I would say... "Tu é o cara!!" Once again and again.... thank you.
@thomasulatowski3012
@thomasulatowski3012 3 жыл бұрын
So concise. A really great example. I learned a lot. Thanks Web Dev SIMPLIFIED!
@jacegarth
@jacegarth 5 ай бұрын
Hi, just found your video here (never seen any of your videos before). 1:18 into the view, paused, subscribed. I can see this is going to be useful...
@chiptaylor1124
@chiptaylor1124 3 жыл бұрын
I learned a lot from this video Kyle. Thank you for all the excellent content you create.
@aleksd286
@aleksd286 3 жыл бұрын
Finally Kyle using proper HTML semantics :D
@matthewharting3390
@matthewharting3390 Жыл бұрын
Is there a reason why you did not put the carousel buttons below the instead of on top? If they were placed below then there would be no need for z-index which can end up overlapping drop-down menus. Great video though, I will forever use this carousel. Thank you!
@pazispeace
@pazispeace 2 жыл бұрын
that code looks fancy! you explain so well that it is easy to understand what you are doing!
@miguelgra92
@miguelgra92 2 жыл бұрын
This was a huge help, even learned a few new concepts! Thanks Bruv!
@aleeizhere
@aleeizhere 3 жыл бұрын
this guy has names his channel so honestly.
@inteJarKilaboma
@inteJarKilaboma Жыл бұрын
Man you are my hero.......so smart. I salute you
@BagelsAfterMidnight
@BagelsAfterMidnight Жыл бұрын
This was a lifesaver. Thank you!
@MeezanTheFairBloke
@MeezanTheFairBloke 3 жыл бұрын
The way you operated that JS made my head spin :D Great vid though, one of these day I am going to understand exactly what is going on here...
@BBStub3
@BBStub3 3 жыл бұрын
Very nice, you make it look so easy. If I'll ever make a carousel in 15 min. I'll be awesome,... More awesome then I already am.
@carlosz1858
@carlosz1858 2 жыл бұрын
thanks dude, that helped me a lot, greetings from colombia :) have a nice day
@hjetwd
@hjetwd 3 жыл бұрын
nice work! p.s. replace all :focus to :focus-visible
@hjetwd
@hjetwd 3 жыл бұрын
​@@Steel0079 :focus adds an outline when you click with the mouse or tap with your finger. Outline is only needed for navigation when pressing the Tab key. To do this, they came up with :focus-visible - the state only when focusing from the keyboard.
@nadavbensimon1267
@nadavbensimon1267 2 жыл бұрын
thanks man i am hoping to be a dev one day.its those types of videos that keep encourge me to cods.keep the good work
@ajaymishra1511
@ajaymishra1511 Жыл бұрын
Katar patar katar patar and boom 💥 Image carousel ready
@prsmahajan
@prsmahajan 3 жыл бұрын
That ahen moment felt because of Kyle Cook😍👊
@Wilespro1
@Wilespro1 2 жыл бұрын
beautiful way of creating a carousel. Thanks!
@yyk9881
@yyk9881 2 жыл бұрын
This man is the Best! I think Kyle is a genius. 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍
@ban_droid
@ban_droid 3 жыл бұрын
Please make something like this but with swipe gesture too
@frankthedsigner558
@frankthedsigner558 3 жыл бұрын
Second that, a quick swiping tut would be a good follow-up video. Love your content!
@andikabeatbox
@andikabeatbox Ай бұрын
thank you bro, you are awesome! nice tutorials
@mykalimba
@mykalimba 3 жыл бұрын
11:35 In instances where your offset is always small-ish, these two checks can be replaced with a single calculation: newIndex = (newIndex + slides.children.length) % slides.children.length; (This assumes there is at least one slide in the carousel.)
@maelstrom57
@maelstrom57 3 жыл бұрын
Yep.
@argylleagen
@argylleagen Жыл бұрын
Recently found out your channel and I am mesmerised by your work and skillset. Not to mention, quite jealous! Keep going Kyle, you have yourself a sub
@alexisgarai296
@alexisgarai296 2 жыл бұрын
so cool dude, this is exactly the type of learning support I needed - thanks
@rework7562
@rework7562 Жыл бұрын
In this video you use the spread operator on the array (script.js => line 11). I would love to see a more in depth video on this topic because I can't figure out how it actually works in a case like this.
@yicongshi
@yicongshi Ай бұрын
thank you very much! learn a lot step by step!
@FilledStacks
@FilledStacks 2 жыл бұрын
Great tutorial. Great tutorial. Thanks for the clarity in the explanation and adding the additional details that might otherwise go un-noticed.
@Chuksteve-Live
@Chuksteve-Live 2 жыл бұрын
Thank you very much for this lecture. I have just be able to execute a project with it.
@nicholaslewis279
@nicholaslewis279 2 жыл бұрын
The JS part was crazy as hell. I was with you until that very moment (probably because that was my very first time typing JS) lmao Still managed to do it though with minimal pauses :D
@axelpaillaud7542
@axelpaillaud7542 Жыл бұрын
It was amazing, and so much simple than some other carousel tutorials, thanks you very much !
@_werther
@_werther 2 жыл бұрын
Always love your way man, congrats
@amniar8158
@amniar8158 2 жыл бұрын
thanks man never give up
@briangrover1625
@briangrover1625 2 жыл бұрын
Fantastic tutorial. Thank you!
@pietrot90
@pietrot90 Жыл бұрын
thank you! your tutorials are just amazing!!
@akodamathe
@akodamathe 2 жыл бұрын
Clean, easy to understand, that's what I needed. Thanks a lot!
@gustavocastro4697
@gustavocastro4697 2 жыл бұрын
Helps me a lot, thanks, i appreciate your content a lot!!!
@promohican8222
@promohican8222 3 жыл бұрын
You're working so fast damn
@doomguy2135
@doomguy2135 3 жыл бұрын
cant wait to try this with react
@santoshkadam8431
@santoshkadam8431 Жыл бұрын
Honestly overall designing carousel similar to what you did is not big think. Bu t I am simply amazed with the speed.
@koka-on6dt
@koka-on6dt 3 жыл бұрын
Your video always useful to me! I just struggled with how to solve the issues of vanilla js and css carousel. Thank you Kyle.
@andriiauziak1178
@andriiauziak1178 3 жыл бұрын
amazingness in simplicity
@vendettamalize7209
@vendettamalize7209 3 жыл бұрын
nvermind i kept clicking left anyways it worked thanks ILOVEU
@bonnes04
@bonnes04 2 жыл бұрын
you make it look so simple
@Al-no2fm
@Al-no2fm 3 жыл бұрын
Perfect little project for fe devs
@Liquidian
@Liquidian 2 жыл бұрын
Thanks, this was educational and practical.
@PiccolosDaughter
@PiccolosDaughter 2 жыл бұрын
"position this ab-so-lutely" *giggles to self*
@nikhil6842
@nikhil6842 2 жыл бұрын
I've seen lots of tutorials but no one came close this.
@JasonKuffler
@JasonKuffler Жыл бұрын
Awesome sauce! Thanks :D
@guyfawkes6930
@guyfawkes6930 3 жыл бұрын
That's exactly what i need man ❤️❤️❤️
@MusicIsLifeFM
@MusicIsLifeFM 3 жыл бұрын
Excellent thank you!
@brendensong8000
@brendensong8000 Жыл бұрын
So simple, but very effective!!! love your videos!
@TheMetalMag
@TheMetalMag 3 жыл бұрын
Wow u kicked my ass, so much knowledge. Thank you!
@TheToocool4all
@TheToocool4all 9 ай бұрын
Great tutorial.
@Aalok464
@Aalok464 3 жыл бұрын
I was just going to see some new videos of you and you uploaded one video
@ajlebeau
@ajlebeau Жыл бұрын
You are undoubtably a rock star! But who is this code "simplified" for exactly? Who is your target audience? I'm a beginner and it's really hard to follow. Regardless, I've learned so much from you. Thank YOU!
@Mrabdulazizbidani07
@Mrabdulazizbidani07 3 жыл бұрын
Perfect this what I was looking for🥰👍🏼
@StaridasGeography
@StaridasGeography 3 жыл бұрын
Awesome! How about making a part two, where images are loaded from json via the fetch promise? 😉😉
@ricardosandoval3848
@ricardosandoval3848 3 жыл бұрын
I’ve been looking for this, thank you!!
@maheshsangam6212
@maheshsangam6212 Жыл бұрын
this carousel changing image once you click on arrow but is it possible to change it automatically and also work with arrow buttons... i mean slider will move images automatically :)
@burgasHoH
@burgasHoH 3 жыл бұрын
Great stuff man !
@bergjoel93
@bergjoel93 7 ай бұрын
When doing a querySelector for an element you want to interact with or that might have an event listener, is it common practice to use an attribute to select it instead of a class or ID?
@yunalee6221
@yunalee6221 2 жыл бұрын
You're the best!!!Thank you :)
@jawndice
@jawndice 2 жыл бұрын
You make it look so easy. May I ask how long have you been coding for?
@noxagen
@noxagen 2 жыл бұрын
thanks for another lesson bro
@mrmrsnobody7662
@mrmrsnobody7662 Жыл бұрын
Thanks for this video
@keinan7667
@keinan7667 Жыл бұрын
How might you make this slider automatically activate every a few seconds, in addition to using these buttons? - Thanks for the videos!
@realestatehomerunspodcast6047
@realestatehomerunspodcast6047 Жыл бұрын
Great video! I love the video features. Which video editor do you use?
@techniquejoseph
@techniquejoseph Жыл бұрын
Thank You Sir!
@Amanpreetkaur16
@Amanpreetkaur16 3 жыл бұрын
Thanks ❤️❤️
@rameenana
@rameenana Жыл бұрын
Thanks man. Very useful video. How can we add auto slide to this?
@codedusting
@codedusting Жыл бұрын
How is this accessible? Does it work with keyboard only? If I have content within with links, can I select it only for active slide?
@jorgemeza4364
@jorgemeza4364 2 жыл бұрын
You rock man
@brendariley2431
@brendariley2431 Жыл бұрын
This is AMAZING!! You are always the best in your tutorials - thank you so much! Just a quick question, but how could you add soe text on top of the images, each slide has something different on it. I tried to embed it within the div's and img src's, but failed... Any kind of advice would be greatly appreciated!
@subramanibala1988
@subramanibala1988 2 жыл бұрын
Hi Kyle, Why you are using data attribute? Can you please explain why we are not using CSS class name?
@Satishkumar-rx7oy
@Satishkumar-rx7oy 3 жыл бұрын
very helpful tutorial
@sashanilssen
@sashanilssen Жыл бұрын
This tutorial was great, I had some issues but I solved them eventually. My only gripe is that the arrows seem arbitrary, as clicking either of them has the same effect and scroll in the same direction. I'm new to JavaScript so I don't know how to fix this myself, where would you recommend I start with that?
@mohdgulzar5178
@mohdgulzar5178 Жыл бұрын
How can i make images automatic change
@VoXelHDCom
@VoXelHDCom Жыл бұрын
Hey, how can i put text on each image and a button for like a store?
@melrosemediaonline
@melrosemediaonline Жыл бұрын
Hi, What intellisense plugin do you use?
@RebelCoderX
@RebelCoderX Ай бұрын
That's cool. But I was looking for a way to drag it.. Because I need to build a control which I need to be able to drag vertically.. Not like a input type=range though.. Because I need other (not draggable) stuff to be connected to it.. So I need to know the screen position.. I think.. I'm kinda new at this stuff.. I managed to drag divs before.. But now I need to contrain the dragging to horizontal and be able to drop it anywhere within a certain range.
@danielcrompton7818
@danielcrompton7818 Жыл бұрын
How would you add the classic slide to it?
@motivationdiverse3485
@motivationdiverse3485 3 жыл бұрын
Amazing as always bro, really helpful Keep up the good work bro :)
@irfansaputra5744
@irfansaputra5744 2 жыл бұрын
How do you make this slides automatically every a few seconds?
@omega.developer
@omega.developer 3 жыл бұрын
This is super cool
Learn CSS Animation In 15 Minutes
15:33
Web Dev Simplified
Рет қаралды 780 М.
How To Use Libraries Like A Senior Dev
9:53
Web Dev Simplified
Рет қаралды 49 М.
Vampire SUCKS Human Energy 🧛🏻‍♂️🪫 (ft. @StevenHe )
0:34
Alan Chikin Chow
Рет қаралды 138 МЛН
I Sent a Subscriber to Disneyland
0:27
MrBeast
Рет қаралды 104 МЛН
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН
Subtle, yet Beautiful Scroll Animations
5:04
Beyond Fireship
Рет қаралды 1,8 МЛН
Build a JavaScript IMAGE SLIDER in 15 minutes! 🖼️
15:49
Bro Code
Рет қаралды 59 М.
5 simple tips to making responsive layouts the easy way
15:54
Kevin Powell
Рет қаралды 784 М.
The CSS Display Property is Changing Forever
15:20
Web Dev Simplified
Рет қаралды 77 М.
Vampire SUCKS Human Energy 🧛🏻‍♂️🪫 (ft. @StevenHe )
0:34
Alan Chikin Chow
Рет қаралды 138 МЛН