How To Create An Image Slider In HTML, CSS & Javascript

  Рет қаралды 481,083

developedbyed

developedbyed

Күн бұрын

Пікірлер: 675
@akifahmed9610
@akifahmed9610 Жыл бұрын
We need more such tutorials like these. Handling small projects without use of any library is such a great way to learn.
@kevinariza603
@kevinariza603 4 жыл бұрын
Hello people! Also, you can add another event listener to check if the screen size changes and update the size variable accordingly, so it becomes responsive. This is what I did: I Changed this: const size = carouselImages[0].clientWidth; By this: let size = carouselImages[0].clientWidth; And I added this to the script: window.addEventListener('resize', () => { carouselSlide.style.transition = "none"; size = carouselImages[0].clientWidth; carouselSlide.style.transform = 'translateX(' + (-size * counter) + 'px)'; }); Thanks for these tutorials, Ed, you are great!
@ihatejart123
@ihatejart123 4 жыл бұрын
unfortunately doesnt work for me :( Any idea or tips? is there a specific position within the script for the new eventlistener to place it in? help would be much appreciated :)
@kevinariza603
@kevinariza603 4 жыл бұрын
@@ihatejart123 Here is the source code, feel free to explore/fork/download it and use it to your own need: github.com/Kevwas/image-slider/ If you want something a bit more advanced, taste this other image-slider I made with Bootstrap: github.com/Kevwas/image-slider-2/ Here there is another good example: w3schools.com/howto/howto_js_slideshow.asp
@annaylak2618
@annaylak2618 3 жыл бұрын
thanks for this! it works on my code. Issue was, when I click next or prev, it doesn't fully show the full picture.
@kevinariza603
@kevinariza603 3 жыл бұрын
@@annaylak2618 Glad it helped you :)
@stormyandink8549
@stormyandink8549 3 жыл бұрын
thank you so much! You've saved me!
@tinycabincreative
@tinycabincreative 5 жыл бұрын
13:43 "Fired" Relatable. Haha Thanks for such a great tutorial this has been a huge help, you're a wicked coder and I would love to see more.
@kazimuntasir
@kazimuntasir 3 жыл бұрын
@Santino Hector I have followed all instructions, but my carousel isn't working. Would you please kindly send me your code...so that I can find my error. Thanks
@tonysmarks3578
@tonysmarks3578 5 жыл бұрын
I'm happen to use carousel in my project and I don't want to require bootstrap. So this is a great video for me!!!
@InGreed666
@InGreed666 5 жыл бұрын
same here but somehow the javascript doesnt seem to work on my page at all.. idk what going on
@hamzadahmani9489
@hamzadahmani9489 4 жыл бұрын
@@InGreed666 make sure if you linked the js file well
@mouhamaddiop1144
@mouhamaddiop1144 4 жыл бұрын
It's always better to do things by yourself, especially if it's for learning purpose. Thank you very much for what you do.
@developedbyed
@developedbyed 6 жыл бұрын
Thanks for the positive feedback on these tutorials so far. Let me know if you want to see something else!
@Student-fd4go
@Student-fd4go 6 жыл бұрын
Works well, unless you use a page that's not full screen or resize the page during use, can you explain how to make it mobile/resize friendly?
@sugandharao4221
@sugandharao4221 5 жыл бұрын
Can you show how to add radio buttons at the bottom and control navigation of slides with that?
@armanhanda
@armanhanda 5 жыл бұрын
Hey! Great tutorial man! Any idea how we can use touch gestures like swipe left and swipe right to fire the previous and next events? Also, will this be responsive to viewport size? Thanks 🙏🏼
@ayyubayyyub9415
@ayyubayyyub9415 5 жыл бұрын
How old are you ed please tell me
@kulumwangu3366
@kulumwangu3366 4 жыл бұрын
Hi Dev I have a query my buttons do not want to work please assist
@eymeen
@eymeen 2 жыл бұрын
I was searching in youtube about this, I opened this video and when I see your intro I was like "YEEEEEEEEESSSSS" I missed your tutorials a lot, I'm now a laravel guy...
@Rob-cq1nf
@Rob-cq1nf 2 жыл бұрын
oldie but goldie :) I really enjoy your "older" content. Keep up the good work
@Photo-Ninja
@Photo-Ninja Жыл бұрын
For responsiveness don't use the JS solutions posted below, just use this simple css: .carousel-container { width: 60%; margin: auto; overflow: hidden; } .carousel-slide { display: flex; aspect-ratio: 2 / 1; /*
@quangtoanta8577
@quangtoanta8577 3 жыл бұрын
There're many tutorials out there but only you have videos giuding me with your voice and It's really understandable and really useful. Again, thank you alot!
@marcjosephmanarin778
@marcjosephmanarin778 6 жыл бұрын
my problem is this Cannot read property 'id' of undefined. at this line if (carouselImages[counter].id === 'lastClone') { please help me
@chrisj.2611
@chrisj.2611 4 жыл бұрын
Yap, same here.
@chrisj.2611
@chrisj.2611 4 жыл бұрын
I dont know why but after I used this part (found it way below in the comments) and just renamed the variable names (b/c i gave it different ones) it worked for me: carouselSlide.addEventListener('transitionend', () => { if(carouselImages[counter].id === 'lastClone') { carouselSlide.style.transition = "none"; counter = carouselImages.length - 2; carouselSlide.style.transform = 'translateX(' + (-size * counter) + 'px)'; } else if(carouselImages[counter].id === 'firstClone') { carouselSlide.style.transition = "none"; counter = carouselImages.length - counter; carouselSlide.style.transform = 'translateX(' + (-size * counter) + 'px)'; } });
@codenamegrant
@codenamegrant 4 жыл бұрын
8:46; I found that making changes to the code and refreshing the page responds with the incorrect clientWidth, and so my slider remains on the lastClone image. I dont know why this happens, but to fix it, I have to use Ctrl+F5 to refresh the page instead of a normal refresh/reload.
@mayankkumar1417
@mayankkumar1417 3 жыл бұрын
It also happening with me , did you solve the problem now?
@mayankkumar1417
@mayankkumar1417 3 жыл бұрын
I think the first carouselSlide.style.transform = 'translateX(' + (-size * counter) + 'px)'; is not working everytime.
@dCoder92
@dCoder92 2 жыл бұрын
The noises your mic is doing is real ASMR for me, thanks!
@lefka2523
@lefka2523 3 жыл бұрын
console.log(counter) error does not work. everything is working but the counter does not work. can someone tell me why?
@gejohans
@gejohans 3 жыл бұрын
My get often stuck when I open the page but when I refresh, it's ok. What have I done wrong?
@taruntomar7947
@taruntomar7947 3 жыл бұрын
Thanks for saving my job.I now feel confident.After looking more than 50 videos I finally got what I was looking for..(subscription-Done). Love from India
@eshendetesia3776
@eshendetesia3776 2 жыл бұрын
Ed, you are the best teacher on the internet. The way you explain the things are very easy to understand!
@Richard-wh6wg
@Richard-wh6wg 5 жыл бұрын
I've used the same code as you did, but that didn't work out. So, I have made mine one following the same logic, and it worked out. Thx my man
@andreistar0533
@andreistar0533 4 жыл бұрын
can u tell me the code it doesn't work for me either
@jorgeartaza9030
@jorgeartaza9030 5 жыл бұрын
the code doesn't work can you help transitionend section doesn't work.
@dewanshpatle3630
@dewanshpatle3630 4 жыл бұрын
Same
@dewanshpatle3630
@dewanshpatle3630 4 жыл бұрын
If you find the solution do tell me
@tokochagunava5478
@tokochagunava5478 3 жыл бұрын
guys, how to add auto slide on shits in js? for example after 5-10 second's slide automaticly?
@jnnnle
@jnnnle 5 жыл бұрын
Wonderfully crisp and to the point, thank you for a grwat tutorial. It would be helpful if you linked the source code.
@william.darrigo
@william.darrigo 2 жыл бұрын
thank you! this was the only tutorial I could find that could do a nice smooth carousel. You explained it awesomingly.
@obelisk2676
@obelisk2676 4 жыл бұрын
Lovely video, forgot to link the css file and spent 5 minutes reading out each line of code. Keep up the good work!
@AJ-Pixelyze
@AJ-Pixelyze 8 ай бұрын
Good tutorial, my question is, why clone when you could have reset how you access to display the element would the "transitionend" event still work? I built a slider but everytime I press on the next or prev to reset the position it automatically slides to that original element and not doing what your slider does.
@EffuseDex
@EffuseDex 6 жыл бұрын
Loved this, super helpful!
@seantownz4519
@seantownz4519 2 жыл бұрын
Im confused with the first clone and last clone. I have the transition but but the first image doesnt transition back to the last image. It just keeps going till i run out of images
@udhavkansal3378
@udhavkansal3378 4 жыл бұрын
Hey Ed, I didn't get the counter part. what is counter doing and how you shift the original image in the slider?? plz help me.
@bazlajter1525
@bazlajter1525 4 жыл бұрын
God bless you man! After much torment, I found your video and made an infinite carousel. Thanks a lot!
@kazimuntasir
@kazimuntasir 3 жыл бұрын
I have followed all instructions, but my carousel isn't working. Would you please kindly send me your code...so that I can find my error. Thanks
@gmanpublications
@gmanpublications 5 жыл бұрын
Hi, I am following along with the video and I noticed a couple of things. First is that there is more than one image instead of only showing one at a time. The second is when I ran the following code... carouselSlide.addEventListener('transitionend', () =>{ console.log('Fired'); }); No fired doesn't show up when I click next.
@MuhammadShahbaz-fg4jh
@MuhammadShahbaz-fg4jh 4 жыл бұрын
For one image at a time, check your css, in parent container, use overflow:hidden
@Jehovah77
@Jehovah77 4 жыл бұрын
i had this problem my problem was in this line carouselSlide.style.transition = "transform 0.4s ease-in-out" 0.4s was 0.4 so fired didn't work.
@andreistar0533
@andreistar0533 4 жыл бұрын
I have an error it says Uncaught TypeError: Cannot read property 'clientWidth' of undefined
@garethbaldwin6413
@garethbaldwin6413 4 жыл бұрын
same
@davidegg1820
@davidegg1820 4 жыл бұрын
same
@Dev-qy7wv
@Dev-qy7wv 4 жыл бұрын
the issue is with browser compatibility. Chrome supports clientWidth very well but firefox has issues with this property. As a quick fix I hard coded the value of size.
@IstvanWeisz_logoby
@IstvanWeisz_logoby Жыл бұрын
greatest slider video that I see!!!! Thanks Ed!!!!!
@kevinsing8948
@kevinsing8948 5 жыл бұрын
the code is messed up the moment you add carouselSlide.style.transform= 'translateX(' + (-size*counter)+ 'px)' the following happens : scroll with mouse to zoom in and out and you will see multiple images within the frame(60% width border). images dont fit border, only works with 100% zoom, change the zoom and enjoy your headache.
@tadas4785
@tadas4785 5 жыл бұрын
It happens because size property is set upon page load. It is constant and doesn't change if you zoom or resize window. You can zoom page and then refresh, after that it should work fine. In fact this carousel is responsive, because it is not so common to change window size during use-time. If you want to make it 100% clean, just add an event, which would change 'size' property if page is resized. Like this: window.onresize = () => { size = carouselImages[0].clientWidth; carouselSlide.style.transition = "none"; carouselSlide.style.transform = "translateX(" + -size * counter + "px)"; }; And don't forget to set size as 'let' variable, since you can't change value of constant.
@kevinsing8948
@kevinsing8948 5 жыл бұрын
@@tadas4785 thanks for the replay, yah i figured that later,
@TheJFMR
@TheJFMR 4 жыл бұрын
hahahaaha enjoy your headache
@gom4stick
@gom4stick 4 жыл бұрын
Hi Dev, thanks for this amazinz video. im doing my own webpage and I got a problem with the imgs. In your video, the images fill up the container: carrousel-slide. Im trying to do the same, but mines doesnt. when i code display:flex, they go one beside the other, but they dont fill up the container. I gave them the exactly width and height on PS, but the same. is there something you could recomend. please...!!! thanks Cristian
@Tien-Tjie
@Tien-Tjie 4 жыл бұрын
did you figure it out im having the same problem
@yourpaldrewdle3893
@yourpaldrewdle3893 4 жыл бұрын
set the width and height of the image to the same width and height of the container
@tunaralyarzada
@tunaralyarzada 2 жыл бұрын
i have also same issue)
@cyntheatimothy5812
@cyntheatimothy5812 2 жыл бұрын
Try increasing just the height..in my case setting height to 700px fixed the issue
@HotDogRacing
@HotDogRacing 2 жыл бұрын
For me @8:51 If I check in the console with console.log(carouselImages[0].clientWidth) it returns the correct width, but if I do console.log(size) it returns 0.
@nielfollero5
@nielfollero5 4 жыл бұрын
That transform = translate in js is bothering me. You used + in both previous and next, it should be moving in the same direction whichever button you click but wasn't. I'm mind blown but I'm sure I misunderstood this. Can someone explain?
@IshratJahan-bf6fw
@IshratJahan-bf6fw 3 жыл бұрын
My images are not fitting into that black box behind the images all the images are cut half in other images it is not a full image .. I hope you understood my problem and will able to help me.
@iqronegoro1538
@iqronegoro1538 2 жыл бұрын
this is what i search for a week
@mailomailo
@mailomailo 4 жыл бұрын
hi, i'm having the problem that the script is not working at all. i tried various options like external file or inline sricpt - that should not be the problem... please help me
@zdarofMERGAITES
@zdarofMERGAITES 4 жыл бұрын
Uncaught TypeError: Cannot read property 'clientWidth' of undefined I get this kind of headache, and buttons isnt doing anything...
@matahoneyy
@matahoneyy 4 жыл бұрын
same hereee! help
@tahirahmedt9156
@tahirahmedt9156 4 жыл бұрын
@@matahoneyy check if you are using queryselctor or queryselectorall
@rezzailham7682
@rezzailham7682 4 жыл бұрын
same here,, help please
@mitchellmadden183
@mitchellmadden183 4 жыл бұрын
same hereee. i even tried setting the size to #lastClone.clientwidth and nothing happens
@SammyLame
@SammyLame 2 жыл бұрын
I just dont undersrand the syntax behind how we write this transform translate, and the way we use qotation marks and closures. Also cant find any information about it
@MissDeeJoy
@MissDeeJoy 5 жыл бұрын
Thank you so much for this tutorial ! It helped me a looooot ! Your explainations are very clear considering JS is soooo complicated haha thanks mate !
@kazimuntasir
@kazimuntasir 3 жыл бұрын
I have followed all instructions, but my carousel isn't working. Would you please kindly send me your code...so that I can find my error. Thanks
@tiaan_va
@tiaan_va 2 жыл бұрын
@@kazimuntasir maybe learn some more actual JavaScript before you do these tutorials. The point of this is not to copy his code but to see what logic is needed and if you know even basic js you can use this logic to build it without needing to copy code. There is no point to copy code if you don’t know how to debug it.
@kazimuntasir
@kazimuntasir 2 жыл бұрын
@Tiaan van Aardt Thanks brother.❤️❤️
@IshratJahan-bf6fw
@IshratJahan-bf6fw 3 жыл бұрын
Can you tell me what was the size of the pictures of yours? Because it is not matching with mine. I have been trying these pictures resolution code for 2 days but I still can't get it right... I hope you can help me ASAP...🙏🙏
@afyaali4618
@afyaali4618 4 жыл бұрын
hello ! my prev and next button not working .please why?
@rakeshsoni8858
@rakeshsoni8858 3 жыл бұрын
I wrote the same code for 1920x1080 resolution pictures but when I am resizing it the site is not looking much responsive
@geekprobin1456
@geekprobin1456 4 жыл бұрын
Great Video about image slider! Especially that sliding effect is really awesome.
@alexlowe9863
@alexlowe9863 4 жыл бұрын
This is one of the best tutorials on this topic. It's short and sweet. Thanks for the great video. It was exactly what I was looking for.
@cosmicbeam7505
@cosmicbeam7505 4 жыл бұрын
Nice Video. Why does clientWidth return 0 when I reload the page? Is there a solution ?
@berintandaniel1643
@berintandaniel1643 3 жыл бұрын
the script stops working if u reload from the button but if you ctrl+f5, everything is fine?
@linad2086
@linad2086 4 жыл бұрын
Hey the Video is great but could you pleease add the bubble Buttons description?
@rhyler733
@rhyler733 4 жыл бұрын
yes that would be really nice to know :)
@TWspk66
@TWspk66 3 жыл бұрын
Thank you for the tutorial ! I would like to know how to solve the error : it keep saying that : "app.js:11 Uncaught TypeError: Cannot read properties of undefined (reading 'clientWidth')" @@ it makes i press prev or next btn , it doesn't work :(
@hebasalem949
@hebasalem949 5 жыл бұрын
thank you very much .... i need to add a pagination or bullets at the bottom , do you think you could help me in a simple way like that video? thanks ..
@henrycode679
@henrycode679 2 жыл бұрын
I always love seeing this my friend coding and learn allot from him.. i wish i see him eye to eye someday 💓💓
@mandyjeans
@mandyjeans 2 жыл бұрын
Actually I based my slider on my website off this tutorial but I have a problem with the slider not actually working on my website until the page is refreshed. Help?
@pranaykrmajee1432
@pranaykrmajee1432 3 жыл бұрын
My arrows are moving along with the images and disappears after one click. Any solution ?
@alanhanley214
@alanhanley214 2 жыл бұрын
Just came across this video, thank you for a fantastic tutorial, it's just what I needed to help finish my uni project
@mosdev1663
@mosdev1663 3 жыл бұрын
doesn't Work for me.. Uncaught TypeError: Cannot read property 'id' of undefined / .id === 'firtsClone' and for lastClone.. Can you explane me please ? Thank you..
@0bbie610
@0bbie610 5 жыл бұрын
Oof how would you make this mobile responsive. It sizes down my images when i size my window down
@anaisrevellat5692
@anaisrevellat5692 5 жыл бұрын
Try to do this like me: you add max-width: xxx px and min-width: xxx px on your .carousel-container, you can test it using Firefox Developer Tool for instance
@freddy7304
@freddy7304 4 жыл бұрын
just declare the elements as a flex box
@arindam1249
@arindam1249 4 жыл бұрын
media query
@oliverbosnjak4361
@oliverbosnjak4361 2 жыл бұрын
My slider didn't work when dimension of my screen in less then 420px(for mobile version) did somebody know why? otherwise it does everything right.
@rakibhasanrahad6994
@rakibhasanrahad6994 4 жыл бұрын
dev ed bro u are a little bit fast! You are awesome no doubt! But it would be helpful if you add more explanations!
@ganesha123100
@ganesha123100 Жыл бұрын
Excellent video. Many thanks for taking the time to create this awesome tutorial.
@okepaul8509
@okepaul8509 4 жыл бұрын
Great tutorial, I want to know if the JavaScript would work for multiple sliders on a page or I'd have have to duplicate the JavaScript for as many sliders as I would have on the page?
@syrgakomuraliev
@syrgakomuraliev 5 жыл бұрын
says that there's no property of .clientWidth
@matanshtepel1230
@matanshtepel1230 5 жыл бұрын
Same!
@Amoniixx
@Amoniixx 5 жыл бұрын
@@matanshtepel1230 script tag has to be put right before the body tag ends, so basically at the bottom of the html code
@robzlegz
@robzlegz 4 жыл бұрын
Uncaught TypeError: Cannot read property '0' of null at main.js:27 at this line: const size = carouselImages[0].clientWidth;
@mohdsahil226
@mohdsahil226 Жыл бұрын
Really Thank you so much for this wonder full trick. Please add more components like this! I would like to buy a course if you have one
@edgybedgy
@edgybedgy 4 жыл бұрын
ty for the easy explanation! unfortunately the slider isn't working on firefox, do you have an idea how to fix that?
@avess100
@avess100 5 жыл бұрын
Do you have a github repo link for this?
@mastercoder6197
@mastercoder6197 4 жыл бұрын
I get error saying cannot read property 'clientWidth' of undefined
@nguyenvinh185
@nguyenvinh185 3 жыл бұрын
Thank you. Great tutorial. Please tell me which theme you using in visual studio code?
@marcozoni9116
@marcozoni9116 2 жыл бұрын
Uncaught TypeError: Cannot read properties of undefined (reading 'clientWidth')
@henriquedeveloper8101
@henriquedeveloper8101 4 жыл бұрын
This man is under the influence of something
@azone1684
@azone1684 5 жыл бұрын
can i use this method for videos or it works only with images and what about responsiveness? please teach us.
@haykrandeksikik
@haykrandeksikik 6 жыл бұрын
Sorry i can't understand this part of code ? can you help me a little... how is the first or last picture appearing in left or right when i am sliding ...please help :) if(carouselImages[counter].id==='lastclone'){ carouselSlide.style.transition='none'; counter = carouselImages.length-2; carouselSlide.style.transform = 'translateX('+ (-size *counter)+ 'px)'; }
@mahdiehsani6993
@mahdiehsani6993 3 жыл бұрын
So far you are one of my favorite teacher, also you make me laugh during ur explaining 😅
@曰_曰
@曰_曰 Жыл бұрын
amazing tutorial!
@kapitankurek
@kapitankurek 4 жыл бұрын
hey I have a problem with the photos being stretched or tightened-up when there is not enough space or too much space. How to fix that?
@pedramkarimi1819
@pedramkarimi1819 4 жыл бұрын
object-fit:cover ; write this into your css code.
@pro-truth
@pro-truth 2 жыл бұрын
Do you have similar for videos? like if you want to replace those images with video clips
@mohammed-i786
@mohammed-i786 5 жыл бұрын
Can you tell me how to autoplay this slider?
@juandiegoolivaabarca4711
@juandiegoolivaabarca4711 5 жыл бұрын
i wanna to know how i can do that?
@sougataghar1179
@sougataghar1179 5 жыл бұрын
just add setInterval
@diegovillamil7999
@diegovillamil7999 4 жыл бұрын
Thanks man for this great tutorial, thumbs up and I hope to see more
@ryanwong9743
@ryanwong9743 4 жыл бұрын
hi there! I'm having an issue when i click next button a couple times it automatically returns to the first image
@sir.buttersworth
@sir.buttersworth 4 жыл бұрын
I can’t see the arrows. When I inspect the page it’s says the arrows are there, but you just can’t see them.
@mantech560
@mantech560 2 жыл бұрын
great stuff mahn.. learnt a lot
@adelminwer2675
@adelminwer2675 4 жыл бұрын
hey dude ,can you help me out i want to make a smaller version of this to put in a page but it doesnt seem to work how can you help me out?'
@ghjafary1304
@ghjafary1304 5 жыл бұрын
It was fabulous...Thank you for making it.
@lazaros23
@lazaros23 2 жыл бұрын
greate video once again! can u please suggest correct img dimensions for that carousel? or in general good image dimensions?
@bokimitrovicc
@bokimitrovicc 4 жыл бұрын
Hi there! i see you are using vs code, as well as I do. I have trouble when trying to set grid-template-are, whenever I save it code transform in one line, can you please be kind and help me ?
@RonyPrime
@RonyPrime 2 жыл бұрын
Now i can create a carousel ...... // Thanks A lot brother......
@BJJNathanSK8
@BJJNathanSK8 4 жыл бұрын
const carouselSlide = document.querySelector('.carousel-slide'); syntax error at that part :( Someone know why?
@stefanmrvic4652
@stefanmrvic4652 3 жыл бұрын
how to make it draggable left and right with hand icon?
@leolowe22
@leolowe22 5 жыл бұрын
transitionend not working in chrome and the code doesnt work in firefox
@jvincent4854
@jvincent4854 4 жыл бұрын
Hmmmm I have a bug for some reason, the first and lastclone will appear for a second before flickering to a different image. It seems it doesn't want to stay on the first or last clone. carouselSlide.addEventListener('transitionend', () => { if (carouselImages[counter].id === 'lastClone') { carouselSlide.style.transition = "none"; counter = carouselImages.length - 2; carouselSlide.style.transform = 'translateX(' + (-size * counter) + 'px)'; } if (carouselImages[counter].id === 'firstClone') { carouselSlide.style.transition = "none"; counter = carouselImages.length - counter; carouselSlide.style.transform = 'translateX(' + (-size * counter) + 'px)'; } });
@jvincent4854
@jvincent4854 4 жыл бұрын
Nevermind, I understand now. I had to have a closer look at the order of the images and the fact some are duplicated. This is going to be interesting when making them dynamic.
@amirbashir5463
@amirbashir5463 Жыл бұрын
Is it possible for us to get an automatic slideshow with this same technique 🙏
@ghaith99000
@ghaith99000 4 жыл бұрын
why when I use fontawesome icons it doesn't work while using buttons it works?
@PaulCresswellcom
@PaulCresswellcom 4 жыл бұрын
Can anyone help me, its driving me mad. I cant get "const width = carouselImages[0].clientWidth;" to return anything but 0.
@andrey7757
@andrey7757 4 жыл бұрын
my problem was that I wrote document.querySelector('img') but instead of this we need to write document.querySelectorAll('img'), maybe it'll help you
@mauricio_vargas
@mauricio_vargas 4 жыл бұрын
Your script tag needed to be at the end of the html of the not at the top
4 жыл бұрын
everytime I reload the page, only my clone picture appears and I can't move forward. I think that the counter messes up or something like that. Pls help!
4 жыл бұрын
Fixed it! Just needed to change clientwidth to naturalwidth!
@Jazir-Sanchez
@Jazir-Sanchez 4 жыл бұрын
@ thanks for the advice i have the same problem.
@Jazir-Sanchez
@Jazir-Sanchez 4 жыл бұрын
never mind did't work for me
@gavintai1
@gavintai1 2 жыл бұрын
I like how you explain what is the function of the code and debugging
@sharriceowens913
@sharriceowens913 3 жыл бұрын
my images only take up 50% of the container..so 2 pics are seen at once..what i do?
@chengyugong7951
@chengyugong7951 4 жыл бұрын
Thank you, but how to make the slideshow responsive when you stretch the window? Looks like if I stretch my window bigger or smaller, the image will display inproperly
@tiaan_va
@tiaan_va 2 жыл бұрын
It is responsive. Resize your window and refresh the page. No normal person will manually resize a window while they are already busy scrolling. The js uses the client width of the element as it is after the page is loaded. It will stay like that until the page is reloaded at a diff size. So if this loads up on a mobile device it will fit to the smaller views. If you want the client width to be responsive then you need to add an event listener to the window size so it updates while the user changes the window size,but this is overkill and will make the page slower for no good reason since 99.999% of people won’t be actively resizing the window after it has been loaded.
@jasongaretthatcher
@jasongaretthatcher 2 жыл бұрын
Great video. Thanks for making it. I occasionally have flickering of the images. Any idea what could be the cause? Is there a solution?
@jasongaretthatcher
@jasongaretthatcher 2 жыл бұрын
I figured it out. Adding -webkit-transform-style: preserve-3d; and -webkit-backface-visibility: hidden; got rid of the flashing.
@cp0bo593
@cp0bo593 2 жыл бұрын
thank you very good explanation learned a lot of mechanics just from this video
@JustinTheVlogger
@JustinTheVlogger 4 жыл бұрын
How can I bring down the photos in the center? because my navigation bar has been covered; also how can I hide the photos when I am going to click the "bars" icon? BTW, I subscribed to your channel last day and I always watch your vids about web dev
Responsive Navigation Bar Tutorial | HTML CSS JAVASCRIPT
35:05
developedbyed
Рет қаралды 1,4 МЛН
Create Crazy 3D Image Slider Effects Using CSS Only
14:07
Lun Dev
Рет қаралды 542 М.
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
How To Create An Animated Image Carousel With CSS/JavaScript
14:10
Web Dev Simplified
Рет қаралды 278 М.
Awesome 3D ANIMATION Javascript Tutorial!
35:11
developedbyed
Рет қаралды 684 М.
A better image reset for your CSS
11:16
Kevin Powell
Рет қаралды 115 М.
Build a JavaScript IMAGE SLIDER in 15 minutes! 🖼️
15:49
Bro Code
Рет қаралды 59 М.
Build an Image Gallery with Vanilla HTML, CSS, and JavaScript
22:54
James Q Quick
Рет қаралды 22 М.
Beginner Vanilla Javascript Project Tutorial
1:15:19
developedbyed
Рет қаралды 905 М.
Animated Responsive Navbar with CSS - Plus Other Useful Tricks
11:40
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 1,2 МЛН