Modern Image Gallery With ES6 Vanilla JavaScript

  Рет қаралды 93,428

Traversy Media

Traversy Media

Күн бұрын

Пікірлер: 247
@TraversyMedia
@TraversyMedia 7 жыл бұрын
As some mentioned, it is a better idea to use event delegation rather than setting the event listener in the foreach. I guess I was hellbent on making the code as short as possible but could be a bit more efficient :( Go ahead and experiment with it...Thanks for watching
@Beth-q3i
@Beth-q3i 7 жыл бұрын
Thank you very much Brad! but how can we do it with angular ? How could we manipulate the DOM? (maybe be with the shadow dom with@ViewChild), can you make a tutorial about it..i tried the code line : this.current.src = img.src ; in onClick(img) function but doesn't workk :), Thanks a lott!
@rahbarali4361
@rahbarali4361 7 жыл бұрын
Brad Sir please create a complete social MEAN App tutorial please plz
@Beth-q3i
@Beth-q3i 6 жыл бұрын
Thank you emotional, i think that's what i did .. I fixed it :), Thank you :).
@jdalzate7390
@jdalzate7390 6 жыл бұрын
Hi Brad, How do we do it if we need to add a lot of images to the gallery?
@nartaas809
@nartaas809 6 жыл бұрын
Good question. What if I have hundreds of photos with random file names? Do I really have to give source for each photo? I don't really want to add 1000 lines of code just to specify path and filenames. There must be a smarter solution to handle large pool of image files. Could you make a tutorial about that?
@hamzajirah
@hamzajirah 7 жыл бұрын
I am glad to tell you that I am now a tutor here in my city, Abuja, Nigeria; largely because of your video tuts like this one. God bless you, Mr Brad.
@kantyDarius
@kantyDarius 7 жыл бұрын
i love your comment man, congratulations!!... greetings from Argentina.
@IlemonaJamesAtuluku
@IlemonaJamesAtuluku 7 жыл бұрын
Which part of Abuja do you reside? I get the notification I watch immediately
@nathltd
@nathltd 7 жыл бұрын
Congrats man. With love from Lagos, Nigeria.
@hamzajirah
@hamzajirah 7 жыл бұрын
Ilemona James Atuluku Garki Area 11
@IlemonaJamesAtuluku
@IlemonaJamesAtuluku 7 жыл бұрын
Am in Central Business Area, close to church gate... hope we can collaborate on projects... let me know your base (Either Back end, front end or fullstack)
@graybab
@graybab 2 жыл бұрын
Not too drawn out and clearly put. This is the best tutorial on this I've found so far.
@Deuz_
@Deuz_ 5 жыл бұрын
Thanks, Brad, you da main man. I'm 30 lost @ life and adulting but I took up your courses and am progressing well. A big thank you for fuelling my fire.
@BalaMuruganKamaraj
@BalaMuruganKamaraj 7 жыл бұрын
i have been following you for past one month and i found that you are the only best teacher for teaching us web devolopement course just an awknowledgement from india
@ademineshat
@ademineshat 5 жыл бұрын
First of all Thank you very much Brad! //For those who wanted with event delegation: const current = document.querySelector('#current'); const imgs = document.querySelector('.imgs'); imgs.addEventListener('click', (e) => { if (e.target.tagName == 'IMG') { current.src = e.target.src; } });
@mikettmaher
@mikettmaher 7 жыл бұрын
Hi Brad, I added the following if statement to check if the current img is the one you've clicked and only applied the animation if it isn't if(current.src !== e.target.src) { current.src = e.target.src; current.classList.add('fade-in'); setTimeout(() => current.classList.remove('fade-in'), 500); } I love your udemy courses, in the middle of the es6 one at the moment and really appreciate the free content you put on youtube too. Keep up the great work thanks!
@olamideabass5587
@olamideabass5587 Жыл бұрын
always straight to the point. your contents have made me a better developer from vanilla js to react to laravel php. God bless you Brad.
@GmoneyMozart
@GmoneyMozart 7 жыл бұрын
Hey Brad, here's something for you to mess around with in case you didn't know. :) *Increment src and class:* img.img$[src="img$.jpeg"]*7 *Increment src same class with specificity for class* img.img$.className[src="img$.jpeg"]*7 *add an alt class* img.img$.className[src="img$.jpeg"][alt="Picture-$"]*7 *stack them individually in separate divs* (.div-item-$>img.img$.className[src="img$.jpeg"])*7
@oliverharan5256
@oliverharan5256 7 жыл бұрын
Thank you Brad, I subscribed to Udemy for your courses.... Awesome stuff
@erichjordaan8864
@erichjordaan8864 5 жыл бұрын
Thank you so much for this Brad, have been looking for a good example for simple vanilla js for a slider to fully understand how it works, cause most you find are in jQuery and thus some of the core elements that are 'omitted' (if this is the right word to use here) are left out due the how jquery works.
@carterjm
@carterjm 4 жыл бұрын
Brad, this is another great tutorial. Unfortunately right now I am staying away from Grid only because IE can't handle it naturally. I know that is a lousy excuse, but it is actually helping me learn CSS better too.
@joel143ful
@joel143ful 7 жыл бұрын
This is what I need and u gave it Brad thank you so much. Your tutorials are my basic building blocks for my career. 😊
@applicationinfo6814
@applicationinfo6814 5 жыл бұрын
It is absolutely crazy that there was a push to take on JQuery without learning your JS fundamentals. I remember some people not even understanding the “query” portion of it haha
@vivekdhoundiyal3618
@vivekdhoundiyal3618 7 жыл бұрын
Thanks man....You are the best teacher with tons of knowledge.
@jeremywoods1370
@jeremywoods1370 7 жыл бұрын
Great video Brad! Thanks!! I love when you comment code and take extra steps to make things more real-life.
@tadakuniyasuda8214
@tadakuniyasuda8214 4 жыл бұрын
OH MY GOD, THE BEST TUTORIAL I HAVE EVER HAD!!!!! I just need to practice even more!! Thank you very very much!!
@MrWyldWolf
@MrWyldWolf 7 жыл бұрын
Another outstanding video. You have taught me quite a bit about code and I'm hoping to get my first job soon. Good luck in the future.
@mrMinstrel
@mrMinstrel 7 жыл бұрын
Great! I'm currently working my way through your "Modern JavaScript from the Beginning" online course and this will tie in nicely...many thanks!
@TraversyMedia
@TraversyMedia 7 жыл бұрын
I am thinking of adding this project :)
@danielstoicamusic
@danielstoicamusic 7 жыл бұрын
You should also think about answering questions posted by students in the course. ;)
@ArfainSyed786
@ArfainSyed786 6 жыл бұрын
Thanks for the video. I am learn visually and your style of teaching is simple but informative. God bless keep up the good work.
@yudisthirahadigustianda489
@yudisthirahadigustianda489 7 жыл бұрын
Damn... This guy is so dedicated, thank you very much Brad
@atepoc7412
@atepoc7412 7 жыл бұрын
AMAZING!! This is more than just a tutorial! We are leveraging so much from your years experience.
@ewaevva4375
@ewaevva4375 5 жыл бұрын
You are such a great teacher, you make it all so understandable. Thank you so much for what you do for us the beginners. Have a very happy Xmas.
@ram_pednekar14
@ram_pednekar14 6 жыл бұрын
You'r just nailing. I don't understand how could I thanks you. If in future anyone gonna ask me who is you'r mentor and I will like undoubtedly gonna tell you'r name. Heartily thanks.
@NathanBudd
@NathanBudd 7 жыл бұрын
Nice new video! I've been out of touch on front end stuff for a while, whilst learning about more back end stuff and improving my PHP (using your content of course!) I'd suggest that when you reference another video that you've done, you link to it in the description, and add a "card" to the KZbin video. Should help increase views. Also, if you mention a VS extension, it would definitely help people like me out if you included the install command, as there are a few "prettier" extensions in the marketplace. Eg, `ext install prettier-vscode`
@birsingh5388
@birsingh5388 7 жыл бұрын
W3schools should hire you as project manager to do all their tutorial up to date and more efficient. :)
@leonelmateus
@leonelmateus 7 жыл бұрын
project manglers can't code
@aseemlalfakawma5084
@aseemlalfakawma5084 7 жыл бұрын
fuck w3schools
@noah123180
@noah123180 7 жыл бұрын
I really like W3schhols. I learned all the basics of HTML, CSS, JS, Bootstrap, jQuery from it, But in the JS section I'm slowly jumping off/writing own Code cause they don't use ES6 and got no tutorial for it...
@h0ckeyd
@h0ckeyd 4 жыл бұрын
@@noah123180 A lot of people recommend the Mozilla library over W3schools today....not totally sure why though, as a beginner it's definitely not as friendly.
@pixikraft9617
@pixikraft9617 7 жыл бұрын
Hey Brad, nice tutorial. To reset the thumbnail opacity, i would have used the listener transitionend and e.propretyName. I think it's a better way to handle this but your solution require less lines of code so i'm not complaining.
@JamesYGGoY
@JamesYGGoY 7 жыл бұрын
thanks for the video, it was great. I don't think you're taking a dig at jquery or anything, but think one way to say it is that you don't need an extra library, that that would bloat the app unnecessarily
@rushabhpatel4291
@rushabhpatel4291 6 жыл бұрын
Fantastic stuff as always Brad.
@arminasabramavicius7226
@arminasabramavicius7226 7 жыл бұрын
very light and clean. Great job
@hamidbakhtiari3986
@hamidbakhtiari3986 6 жыл бұрын
thank you brad with all you videos and courses
@animesh4627
@animesh4627 7 жыл бұрын
Hey Brad, recently I got to know about your channel on KZbin.. i loved its content.. and the way you teach.. It's always a fun while learning by your videos.. You are doing an amazing job.. May god bless you and ur family... Love from India.. And I will be so pleased if you please guide me with the timeline should I follow for becoming a fullstack web developer... I have knowledge of html, CSS and vanilla JavaScript, what to do next?
@edwardju1010
@edwardju1010 7 жыл бұрын
same issue with yours, bro
@paraglide01
@paraglide01 7 жыл бұрын
Thanks Brad great addition to w3schools, love that site. You should do more of these efficienty tutorials.
@pola478
@pola478 5 жыл бұрын
I wish you would do more videos like that. w3schools has a good stuff but you right -code there is sometimes to complicated and it doesn't look modern at all but you still can learn a lot of js from their examples so its good to look into it.
@saidzbiri6247
@saidzbiri6247 7 жыл бұрын
You're the best Brad. Go ahead
@angelheart0212
@angelheart0212 6 жыл бұрын
Wow!! You're just sharing what exactly I've beeeeee.........n wanted !!! You are awesome !!! Thank you for sharing!! I really appreciate that ! This is tremendous helping !!! Even I don't understand all about coding though, I can still much much easy to understand this tutorial ! I have to set up the photo gallery on my client's EC website though, but I've been searching for how to create and some " SIMPLE CODE" like this. Wow! I'm so happy! I shouldn't have payed bunch of money for online coding school..... Like co**c***my...
@geeksy2278
@geeksy2278 7 жыл бұрын
Thank you brad, quality content as always!
@chimpionboy
@chimpionboy 6 жыл бұрын
Beautiful neat clean code. Thanks Brad.
@brentboles1920
@brentboles1920 4 жыл бұрын
I'm a designer, who is trying to learn javscript. Brad your UDemy class has helped a ton. What's throwing me off in this tutorial is the forEach loop, specifically I'm curios what it would look like if was written with a regular function instead of an arrow function. Curious if anyone could help me with that
@mattiusbattol
@mattiusbattol 5 жыл бұрын
You beautiful beautiful man. I've been looking for something like this for ages
@mattiusbattol
@mattiusbattol 5 жыл бұрын
I mean he's just the goddamn man isn't he! best tutor on the internet hands down
@omarilbuur8383
@omarilbuur8383 7 жыл бұрын
Quality stuff Brad, Could you make a video about best security practices making web applications (specially authentication)
@Avabanks2025
@Avabanks2025 7 жыл бұрын
Great Sunday project. Thank you, sir!
@jasurshamsiev5334
@jasurshamsiev5334 6 жыл бұрын
love it man, thanks. Can you make "JavaScript can do that !" series pls? P.S thanks a lot for doing it old way and explaining a EcmaScript 2015 way It is really educative.
@rdonzinc30
@rdonzinc30 4 жыл бұрын
You are such an amazing guy Brad, i just went back to coding again and I’m already way too far 😅 you are an influence 💪🏼 with this project trying to figure out can we apply some text labels on each image that will change as well on each click its more like a multiple function i always see they are using jquery thanks brad
@ralmslb
@ralmslb 7 жыл бұрын
Very cool video. Thank you :) Just don't agree on the overkill forEach to reset the thumbnails opacity. Why not use a pointer/var to the previous thumbnail instead?
@hakunamata_tuh
@hakunamata_tuh 7 жыл бұрын
i'am newbie.. so can you show me how this done?
@ralmslb
@ralmslb 7 жыл бұрын
I'm very newbie js programmer as well, so take this solution with a grain of salt in regards to variable scoping, etc But the general idea is there and working. I've marked the new stuff with NEW in the comments. Check it here: codepen.io/Ralms/pen/jYJOZz
@issam2901
@issam2901 7 жыл бұрын
ralmslb Hy , There is one problem with your implementation : if you click the image twice or more the opacity changes to 1. That is due to the fact that you are assuming that event target will always be different from the current thumbPointer. Adding a condition to the top of the function should solve it if (e.target === thumbPointer) return ; Otherwise your implementation is more efficient and looks much cleaner. gg
@ralmslb
@ralmslb 7 жыл бұрын
Yeah you're right. I've updated the codepen.
@mariocarnival
@mariocarnival 5 жыл бұрын
Nice! However, I suggest you to please, make a part 2 including controls like arrow left and right, captions for pic title, description, option for water mark and so on. Yeah, I will try to implement that with CSS.
@internetexplorer7880
@internetexplorer7880 5 жыл бұрын
He already made plenty on that
@afandir
@afandir 4 жыл бұрын
simple, clear, clean, thank you
@carljeffersonbulatao9582
@carljeffersonbulatao9582 2 жыл бұрын
Hi, I just want to ask if how can I manage to put that same class like "container" in same page then they are both functional? I mean, two the modern tab gallery in the video, in the same page.
@kimanje2patrick290
@kimanje2patrick290 5 жыл бұрын
You are a great teacher. Thanks a lot for this
@michaelvexler
@michaelvexler 7 жыл бұрын
you are more than life saver
@jonathan2715
@jonathan2715 6 жыл бұрын
thanks a lot for this great tutorial, you made it very easy for me, congratulations.. keep doing this great work!
@VickyRomyata
@VickyRomyata 7 жыл бұрын
hello, i am so gratefully for your tutorial i did learn with your video thank you very much Traversy Media.
@VickyRomyata
@VickyRomyata 7 жыл бұрын
i am from Indonesia Success For You............
@yudisthirahadigustianda489
@yudisthirahadigustianda489 7 жыл бұрын
Ane dari indonesia juga mas...
@kamrankhanofficials
@kamrankhanofficials 4 жыл бұрын
i just want to ask if this tutorial is for the same size of images u used or it may be applied on any size of images..
@petsimk
@petsimk 6 жыл бұрын
Excellent image gallery tutorial!
@barneysmith
@barneysmith 7 жыл бұрын
Thank you, great Video. Also great hint with pexels. Maybe you can make a Video about PHP with composer and how to bring a composer project to a production system.
@StackLearner
@StackLearner 7 жыл бұрын
great explanation..
@YogeshYadav-tk9bh
@YogeshYadav-tk9bh 7 жыл бұрын
SIR, Please add a small video recording of your's inside what you upload like you did so many times before, you look awesome while elaborate about what u uploaded.
@nikhiljindal4580
@nikhiljindal4580 4 жыл бұрын
before we removed the fade-in class using timeout , shouldn't it atleast happen for all the pics atleast once and not just for the first pic?
@denyskiparenko1694
@denyskiparenko1694 7 жыл бұрын
Thanks Brad! Your tutorial is really awsome! Continue making such wonderful videos. I'd like to see more new useful features in JS.
@SalmanAGhani
@SalmanAGhani 7 жыл бұрын
Thanks. I really learn alot from your videos.
@Uncaught_in_promise
@Uncaught_in_promise 7 жыл бұрын
I was wondering if I can incorporate this vanilla js code into common.js (which is in jQuery) from my current project?
@topollor6470
@topollor6470 7 жыл бұрын
This vedio was very helpful. Please do a crash course on this JavaScript please.
@ConquerJS
@ConquerJS 7 жыл бұрын
Sweet example to get started! But you're not concerned about having the full size image load in each thumbnail?
@julian.castro18
@julian.castro18 4 жыл бұрын
Great tutorial. Shouldn't we be using actual thumbnails, as in small resolution images for every element in the div .imgs? If the gallery was just part of the website, we'd be loading 8 full res images from the very beginning, and the user may not even be interested in clicking on any of them.
@jasurshamsiev5334
@jasurshamsiev5334 6 жыл бұрын
thanks a lot. You are so incredibly easy to understand.
@albertgalvez2556
@albertgalvez2556 7 жыл бұрын
Brad3CSchoolin', Thank you sir.
@euancorbett1582
@euancorbett1582 6 жыл бұрын
Love your guides! You mind telling me what editor you're using there. Or maybe you have a video on tools like that?
@filip7929
@filip7929 5 жыл бұрын
I would like to say that there is a small problem when you click on the whitespace between the image indicators, black image is displayed. Thank you for the tutorial you are the best btw
@OGBhyve
@OGBhyve 7 жыл бұрын
This is awesome! Could you do an image slider next? I generally think there's a lack of before and after image sliders that look good (I found just one that I liked and they used jQuery).
@LTTheReal
@LTTheReal 7 жыл бұрын
this is great, an idea how I could make the thumbnails the same size if they're originally different dimensions? I'm making a site for someone as a personal learning project so I'd like to know how to make these custom images presentable. Thanks again dude, you're the man!!
@SogMosee
@SogMosee 7 жыл бұрын
I always convert the node list returned by querySelectorAll into a normal array using es6 destructuring so I can use array properties like .length: const imgs = [...document.querySelectorAll('.imgs img')]
@marcosgalaviz4904
@marcosgalaviz4904 4 жыл бұрын
wow very nice, helps me a lot! thanks!
@nenojay6832
@nenojay6832 7 жыл бұрын
could we use the (Current.ClassList.toggle()) To add the class instead of the (setTimeout()) function with the (ClassList.remove()).?
@wolfgangr.3268
@wolfgangr.3268 6 жыл бұрын
3 lines of JS-code and the gallery is functional! But is it userfriendly. I miss a nextImage snd a zoom button. How many additional lines would that be?
@ThiagoTAV
@ThiagoTAV 7 жыл бұрын
Fantastic tutorial, as always!
@citizenbobx
@citizenbobx 7 жыл бұрын
As a newbie to JS, this is sort-of what I'm looking for, but I'm wondering if there's a way to have the selected images appear as a lightbox-modal rather than in an area that's visible by default? I did see the other demo you had about creating modals, but that approach isn't scaleable to a large number of images, is it? Another question I had is whether I can use flexbox for the layout instead of grid. Is there any reason that shouldn't work?
@fvgoya
@fvgoya 7 жыл бұрын
Thank you Brad!! Really cool!!! Is it possible teach us too how to do a slider with that dots telling which image is selected?
@tbx2150
@tbx2150 7 жыл бұрын
exactly what i was looking for. thanks
@ahmetomer1759
@ahmetomer1759 7 жыл бұрын
Thanks a lot Brad you're the best!
@Colstonewall
@Colstonewall 7 жыл бұрын
You the man, Brad!!
@philipkraus243
@philipkraus243 6 жыл бұрын
...so when one of the images in the galery is in portrait, it sets te height of the whole thumbnail row to its height, leaving a whitespace under the other (landscape) images in that row. Can someone tell me a good (and also responsive) way to fix that? I've tried out some things but it wasnt really satisfying... Thanks in advance!!
@evgeniya.m.46
@evgeniya.m.46 6 жыл бұрын
Great stuff, thank you! but It doesn't work with older version of IE browser. If there is a solution for it? Some people don't update browsers
@EightSixx
@EightSixx 7 жыл бұрын
mine grid didn't work :'( What am i doing wrong?... I missed the damn , in the css ".main-img img, .imgs img What do i do to make everything look symmetrical if i don't have the same size images for the gallery...
@skillfulactor09
@skillfulactor09 7 жыл бұрын
hey nice, video love this but there a new application called mongodb compass, its similar to the command line mongodb I was wondering if you can do a video on it its more of a gui interface based and that would be lovely if you can. Love your videos and always learning keep it up stay blessed =)
@lardosian
@lardosian 7 жыл бұрын
Great tutorial Brad. I'm guessing that whenever possible we should make sure all our source images are of equal dimension, as opposed to setting the size in css. Or is either method ok, thanks anyone.
@piwozero
@piwozero 6 жыл бұрын
Hi, i want to create multiple galleries. How can i trigger e.target.src to this certain class="imgs" sibling,which is class="main-img"and grap img and change src ?
@slapiinf518
@slapiinf518 7 жыл бұрын
Excellent video, for more videos with React and vanilla js
@jim.....
@jim..... 7 жыл бұрын
this guy knows his stuff
@arunjiid
@arunjiid 6 жыл бұрын
thanks Traversy media.
@dogafincan
@dogafincan 6 жыл бұрын
Thank you. Just what I needed :)
@techRadiants
@techRadiants 6 жыл бұрын
"Floats and clearing them....and all that craps" man sometime i laugh soo hard while watching your videos
@noibiolamilekan3501
@noibiolamilekan3501 5 жыл бұрын
What is the name of the extension that add column to the end of a statement in CSS?
@bobbypaycheque
@bobbypaycheque 7 жыл бұрын
What changes can be made to this so it will work in multiples on a singe page? For example if I want to have three separate galleries on one page.
@DavidFregoli
@DavidFregoli 7 жыл бұрын
You would have to have a container like .gallery for each one, then cycle through those and put the current code inside the loop with some changes, like, you can't use the #id selector for current, and the imgs list will have to be queried starting from the .gallery, not the document
@alancourtney476
@alancourtney476 7 жыл бұрын
There are many Prettier extensions, Which one did you use ?
@jasurshamsiev5334
@jasurshamsiev5334 6 жыл бұрын
sorry Brad, have you got anything on async functions I just can't seem to understand them that well, Thanks a lot.
@tomvito
@tomvito 7 жыл бұрын
Hey Brad, thanks for this helpful video :) Do you think jQuery is overrated?
@vice2381
@vice2381 6 жыл бұрын
Awesome tutorial. Do you think I can use this great gallery, but associated with images loaded from a mySql table?
@ioannisme7495
@ioannisme7495 5 жыл бұрын
amazing simply and clean...
@dirtlocker
@dirtlocker 4 жыл бұрын
Thanks Brad
@Shahid-zq4kh
@Shahid-zq4kh 7 жыл бұрын
insteadof remove fade-in using timeout. Can’t we use toggle class
Animate Your Font Awesome Icons With JavaScript
18:52
Traversy Media
Рет қаралды 98 М.
Vite Crash Course | Faster Alternative To CRA
16:24
Traversy Media
Рет қаралды 220 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
Full Screen Responsive Image Slider | No Libraries
31:55
Traversy Media
Рет қаралды 97 М.
JavaScript OOP Crash Course (ES5 & ES6)
40:21
Traversy Media
Рет қаралды 594 М.
JavaScript Event Loop -- Visualized!
29:43
ColorCode
Рет қаралды 25 М.
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 1,3 МЛН
Programming Is NOT Enough | Add these 7 skills…
13:19
Travis Media
Рет қаралды 423 М.
Star Ratings With JavaScript & Font Awesome
33:59
Traversy Media
Рет қаралды 105 М.
Vanilla JS Number Facts App - Ajax & Fetch
25:52
Traversy Media
Рет қаралды 47 М.
Build A Speed Typing Game In JavaScript
32:37
Traversy Media
Рет қаралды 102 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН