6/1/2023 0 Comments Astro driving navigatorThis is of course a big problem for the vast majority of websites that do need JavaScript. The method we used to update the DOM (essentially containerDiv.innerHTML = newHTML) handles HTML and CSS updates correctly, but does not execute any JavaScript.This might be OK for small sites, but can become cumbersome on projects with many pages. Requesting HTML fragments (partial templates) from the server requires you to structure your site in a very specific way.The Navigation API is experimental, and while it’s enabled by default on Chrome, it doesn’t work on any other browser at the moment.This method works well for simple demos, but comes with a few important tradeoffs: While my previous article focuses mainly on page transitions, it also talks about the underlying client-side router that makes it possible to use the Shared Element Transition API with Astro: an implementation using the Navigation API and HTML fragments. I covered one of these methods in my previous post, which I used as a way to enable page transitions using the experimental Shared Element Transition API. Over the past couple of months, I’ve been exploring different methods for bringing SPA-like features to Astro websites. Persistent Islands in Astro with Turbo Drive
0 Comments
Leave a Reply. |