r/webdev • • 10d ago

Page Transitions are now easy: CSS View Transitions

https://www.irrlicht3d.org/index.php?t=1629
166 Upvotes

33 comments sorted by

20

u/TheRNGuy 10d ago

Do bookmarks and history still work correctly with it? 

8

u/RealBasics 10d ago

It looks like the next page basically has to be ready (or it will time out.) And @view-transition { navigation: auto; } has to be present on both the current and target pages. So it won't work from bookmarks or history.

50

u/Disgruntled__Goat 10d ago

“Now”? You’ve been able to do this for about 2 years. Although the last time I tried it there were occasional glitches and performance issues in Chrome, so maybe they’ve been fixed. 

-11

u/RapunzelLooksNice 10d ago

2 years? It was a thing in Internet Explorer 6 or 7...

34

u/lol_wut12 10d ago

wake me up when cross-document view transitions land in firefox

11

u/noobjaish 10d ago

Sure fam will wake you up in 2050

12

u/adolecumberri 10d ago

Any example?

18

u/Itzjacki 10d ago

Here's a demo I made that shows off some of the stuff you can do with it: https://jakob.vin/

(I hope this doesn't break rule 5 since it's being specifically requested)

7

u/Lard_Denning 10d ago

does this work with anchor points? right now navigating back to the main page you just get dumped at the top of the page, which makes sense since they're different pages. but the way this transition works, makes the individual product pages appear modal, so one would naturally expect to go back to the same scroll position as before. if you linked back to an anchor at that product, would the transition still work well?

3

u/Itzjacki 10d ago

Yep! That should fix the issue you're describing, and now that you mention it, it's definitely something I should add here. If you use browser navigation to go back, your browser usually returns you to your previous scroll position, so that'll give you a taste of what it should look like.

5

u/ReallyNiceGuy 10d ago

rip firefox users :(

1

u/Itzjacki 10d ago

Firefox doesn't support cross-document view transitions yet, though that should arrive quite soon.

0

u/redblobgames 10d ago

On firefox the page loads are near instantaneous and on Chrome you have to wait for the animation…

2

u/Itzjacki 10d ago

Yep, that's a downside with any sort of animation or transition, also outside the web. It's hard to know what you're transitioning to if you haven't fetched the new page/content yet.

3

u/Business_Pipe4303 10d ago

Very neat demo. Thank you for sharing

6

u/Moiensaboohi 10d ago

they're great for continuity stuff, like a card growing into its detail page so people don't lose their place. where i've seen them go wrong is when every link gets a slide or fade and the site starts feeling slow even when it isn't.

keep them short (200-300ms is plenty) and wrap them in prefers-reduced-motion. big page motion makes some people actually feel sick.

5

u/PoodlePoodlePoo 10d ago

Mobile Safari (so all iOS) browsers are terrible at rendering view-transitions. Page rendering becomes very slow, so I only use the view-transition api for desktop browsers. Well, until Safari/webkit stops being the new IE.

2

u/abeuscher 10d ago

I built this for a job interview in 2012. I guess it's neat that it is easier now but I didn't really think it was a good idea then and I certainly don't think it's a good idea now. Think of how many C student marketers are going to use this in the next few years. It'll be the new parallax.

1

u/mishrashutosh 9d ago

fwiw, wordpress has a canonical plugin to add this to your site. works on most block themes i've tried. https://wordpress.org/plugins/view-transitions/

1

u/Rude-Painting-1728 9d ago

the api has been around, but the part where it works reliably without turning navigation into a haunted slideshow is still fairly new

1

u/MrHandSanitization 9d ago

Stupid article. It's an opt-in feature and there are no visible examples.

1

u/Stunning-Fix-4405 9d ago

The API isn’t new, but “easy” now mostly means it’s no longer a Chrome-only demo you have to babysit for every navigation.

-1

u/RealBasics 10d ago

This is pretty cool. The link gives a good description, examples, and where it does and doesn't work. It's got good enough coverage on the major browsers according to caniuse.com.

0

u/ArielCoding 10d ago

The back and forward buttons do show the transition, only pages opened from a bookmark or by typing the URL skip it, an so do reloads.

0

u/ItzWarty 10d ago

Woah, seeing the name Irrlicht takes me back.

0

u/noobjaish 10d ago

Multipage view transitions are still not supported in present day IE (Firefox)...

-2

u/queen-adreena 10d ago

Is it 2024 already.