How do Nike and Apple make such smooth and touch friendly carousels with pure CSS?

  Рет қаралды 23,310

Steve (Builder.io)

Steve (Builder.io)

Күн бұрын

The scroll-snap property in CSS gives you amazingly smooth and performant scroll snapping for both desktop and mobile browsers. Combine that with element.scrollIntoView() in JS and you have a complete and fully functional carousel that is wonderfully smooth and simple
- Learn more about scroll snap: developer.mozi...
- Browser support: caniuse.com/?s...
- Try it out yourself: jsfiddle.net/L...
- Try a more complex example using JS to programmatically scroll jsfiddle.net/L...

Пікірлер: 19
@dailymeow3283
@dailymeow3283 2 жыл бұрын
Does it need display: flex and overflow-x: scroll on the slides container ?
@Steve8708
@Steve8708 2 жыл бұрын
Correct! You can see a full code example here jsfiddle.net/L1cs6gt5/1/
@xi_red4936
@xi_red4936 7 ай бұрын
Never thought making responsive scrollable cards would turn out to be that easy. Thank you so much for this useful tip.
@jisrite
@jisrite 5 ай бұрын
I know!! I thought this was going to be a big step for me, then i see this video
@auctifer0
@auctifer0 2 жыл бұрын
This is so awesome, can't wait to try it out 💯
@trickster6254
@trickster6254 2 жыл бұрын
Could you please add an example of how to add the next and previous buttons to the jsFiddle? I'm struggling to get that implemented. Amazing video though!
@aaronflorespezantes7051
@aaronflorespezantes7051 4 ай бұрын
please
@bread_loaf8
@bread_loaf8 Жыл бұрын
I love this. Very helpful. Is there a way to make them rotate automatically like the carousel in Bootstrap? Like it would be nice to have them loop through the images automatically while also giving the option to click on the dots to go back to a image the user wants to look at again
@Ro_V_oR
@Ro_V_oR 7 ай бұрын
Thanks so much the scroll-padding was just what I needed
@chetansidhu
@chetansidhu 2 жыл бұрын
I was wondering if there is any way to get rid of the horizontal scroll bar?
@user-qr3hz3vu8g
@user-qr3hz3vu8g 8 ай бұрын
You can using this: /* Hide scrollbar for Chrome, Safari and Opera */ .carousel::-webkit-scrollbar { display: none; } /* Hide scrollbar for IE, Edge and Firefox */ .carousel { -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ }
@FelipeBlanco
@FelipeBlanco 2 жыл бұрын
Tiktok brought me here. Thanks.
@felp4638
@felp4638 5 ай бұрын
Has anyone had any issues with using scroll into view and hijacking the page scroll?
@praveenstakez
@praveenstakez 5 ай бұрын
Oh. That's what the backend is
@haizk
@haizk 8 ай бұрын
wow great
@Aziz-kw6ct
@Aziz-kw6ct 9 ай бұрын
Fascinating
@anonymushadow282
@anonymushadow282 10 ай бұрын
esta obsoleto?
@hinoki.mp4173
@hinoki.mp4173 8 ай бұрын
no, although I don't find it very useful on desktop. Ok it's smooth and snappy on mobile, but you still need to implement in some way the next and prev button on a non-mobile view
@anonymushadow282
@anonymushadow282 8 ай бұрын
@@hinoki.mp4173 thanks, i was searching but it didnt work
The Best Way To Make A CSS Only Carousel In 2024
31:40
Frontend FYI – by Jeroen
Рет қаралды 7 М.
Creating an infinite logo carousel with pure CSS
12:18
Coding with Robby
Рет қаралды 140 М.
Worst flight ever
00:55
Adam W
Рет қаралды 28 МЛН
Incredible: Teacher builds airplane to teach kids behavior! #shorts
00:32
Fabiosa Stories
Рет қаралды 11 МЛН
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 38 МЛН
Award Winning Animation With Only 20 Lines Of CSS?
6:59
Hyperplexed
Рет қаралды 1,8 МЛН
Create a horizontal media scroller with CSS
26:13
Kevin Powell
Рет қаралды 295 М.
Subtle, yet Beautiful Scroll Animations
5:04
Beyond Fireship
Рет қаралды 1,7 МЛН
These CSS PRO Tips & Tricks Will Blow Your Mind!
8:48
Coding2GO
Рет қаралды 351 М.
The Easy Way to Design Top Tier Websites
11:54
Sajid
Рет қаралды 444 М.
Every CSS Animation property
9:26
chunkydotdev
Рет қаралды 71 М.
HTML and CSS Project Tutorial: Pure CSS Image Slider
7:41
Skillthrive
Рет қаралды 311 М.
True parallax with CSS-only is now possible
17:32
Kevin Powell
Рет қаралды 235 М.
Play and Pause in Infinite Slider with CSS Only
13:24
Lun Dev
Рет қаралды 74 М.
Build a Touch Slider with HTML, CSS & JavaScript
34:49
Traversy Media
Рет қаралды 137 М.
Worst flight ever
00:55
Adam W
Рет қаралды 28 МЛН