No video

HTMX and the View Transitions API

  Рет қаралды 14,630

BugBytes

BugBytes

Күн бұрын

In this view, we'll look at the new View Transitions Web API - which can be used to smoothly transition between two states in the DOM.
We'll see how this API is easily integrated into HTMX, and how to define custom animations/transitions when going from one state to another.
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
ko-fi.com/bugb...
▶️ Full Playlist:
• Django & HTMX
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: bugbytes.io/po...
👾 Github: github.com/bug...
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
HTMX Swapping: htmx.org/docs/...
HTMX View Transitions Essay: htmx.org/essay...
#django #htmx

Пікірлер: 56
@AliHassan-wc6nb
@AliHassan-wc6nb 10 ай бұрын
I always make sure to like the videos and save them to watch later if I don't watch them right away.
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks a lot!
@JT-mr3db
@JT-mr3db 10 ай бұрын
One thing to note is that if you have content you are transitioning that is sandwiched in between other elements, the difference in height between the transitioning elements will snap in to place after the transition. You can see this effect in the htmx transition example docs where the content goes from visible to not visible and there are paragraphs in between. I suspect this is because height animations are cpu bound rather than gpu optimized like the view transitions. For simple transitions this is not going to stop anyone clicking "Purchase". You can always use a framework for any bits of UI that requires a more controlled approach.
@tobidegnon4409
@tobidegnon4409 10 ай бұрын
I saw the title and instantly loved it. You keep up to date with trends to bring us great content, thanks so much. I saw the view transition api mention a few weeks ago with the latest release of astro, and was wondering how would that work with htmx and now I have the answer, thanks again.
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks a lot Tobi! How is Astro? Never used it yet.
@tobidegnon4409
@tobidegnon4409 10 ай бұрын
@@bugbytes3923 I haven't tried it, I've just been keeping an eye on it. For me, the most interesting use case is the creation of mostly static sites.
@user-xu7jz4li7e
@user-xu7jz4li7e 10 ай бұрын
Going to save some time this weekend to watch the video. Thanks!
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thank!
@Noritoshi-r8m
@Noritoshi-r8m 10 ай бұрын
What an amazing combination. My favorite transition is the 'elastic', i don't know if it is a native thing in plain css, i tried it in Svelte Transitions libary and it was a great result, specifically for the menu drawer after we click the hamburger icon.
@bugbytes3923
@bugbytes3923 10 ай бұрын
Nice! I’ll need to check that one out.
@iflux8821
@iflux8821 10 ай бұрын
Nice one! Thanks! Getting good old railscasts vibes from watching your content! Could you please consider using dark mode or darker default css for the web page so that it’s easier on eyes? Thank you!
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks a lot - I'm not familiar with Railscasts, but thanks! And good suggestion - I hadn't considered that.
@AmoahDevLabs
@AmoahDevLabs 10 ай бұрын
Great gist as you always do. Keep it up man.
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks dude, I appreciate the support!
@oSpam
@oSpam 10 ай бұрын
Great vid, these are all helpful but I forget the day later lol. It’s in my watch later though so as soon as I need it I know where to find it
@bugbytes3923
@bugbytes3923 10 ай бұрын
Yeah, I make the videos to help me learn and remember sometimes 😁 Thanks for watching!
@seydinaoumarsamabaly1806
@seydinaoumarsamabaly1806 10 ай бұрын
Very useful Tutorial ! Thank you mate !
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks mate!
@dentonholmgren4886
@dentonholmgren4886 6 ай бұрын
Thanks for a great tutorial
@bugbytes3923
@bugbytes3923 6 ай бұрын
Thanks a lot!
@MagnusAnand
@MagnusAnand 10 ай бұрын
Cool video!!
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks a lot!
@themarksmith
@themarksmith 8 ай бұрын
Excellent video!
@bugbytes3923
@bugbytes3923 8 ай бұрын
Thanks!
@sebwylleman
@sebwylleman 9 ай бұрын
Top content, glad I found your channel, keep them coming!
@bugbytes3923
@bugbytes3923 9 ай бұрын
Thanks a lot!
@kai.diefenbach
@kai.diefenbach 10 ай бұрын
Yet another great video! Thanks!
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks a lot!
@nextnoir
@nextnoir 9 ай бұрын
Hi, thank you for the great tutorial! I have a question if you don't mind. How do I realize transitions for several elements on one page? For example a todo list and I want to apply transition effect to each todo (adding, editing, deleting)? If add "sample-transition" to each todo then there is an error "Unexpected duplicate view-transition-name: slide-it"
@CristianMolina
@CristianMolina 9 ай бұрын
Loved it, thx
@bugbytes3923
@bugbytes3923 9 ай бұрын
Awesome, thanks for watching!
@weyrdereveryday3478
@weyrdereveryday3478 7 ай бұрын
Thanx for this intro
@bugbytes3923
@bugbytes3923 7 ай бұрын
Thanks for watching!
@EmptyNonsens
@EmptyNonsens 10 ай бұрын
I would love to see it in a full project
@bugbytes3923
@bugbytes3923 10 ай бұрын
True, good point!
@repotranstech9614
@repotranstech9614 10 ай бұрын
thanks for this informative video
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks for watching!
@ib4112
@ib4112 2 ай бұрын
Does this work on Firefox and Safari?
@ezraklitsie9253
@ezraklitsie9253 10 ай бұрын
thank you sir
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks for watching!
@frameff9073
@frameff9073 10 ай бұрын
good thank
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks for the comment!
@ItsMe-vo1du
@ItsMe-vo1du 10 ай бұрын
I have a counter with 2 buttons, one to increase item and one to decrease from the db, each one has a view , how can I press the buttons to update the values, it upadates in db but in the html content does not until I refresh the page
@ItsMe-vo1du
@ItsMe-vo1du 10 ай бұрын
Is there's a tutorial for that ?
@Septumsempra8818
@Septumsempra8818 10 ай бұрын
Without code I can't help. What's your network message in your browser dev toolbar? Is it returning html when you click the button? If yes then your HTMX code is buggy. If no, then your view isn't returning a response when given a request.
@ItsMe-vo1du
@ItsMe-vo1du 10 ай бұрын
@@Septumsempra8818 cart app view: def add_item_quantity(request, order_number): cart_item_quantity = Cart.objects.get(order_number=order_number) cart_item_quantity.item_quantity += 1 cart_item_quantity.product_price + cart_item_quantity.product_price cart_item_quantity.save() context = { 'cart_item_quantity': cart_item_quantity, } render(request, 'Components/ProductToBuy.html' ,context) def remove_item_quantity(request, order_number): cart_item_quantity = Cart.objects.get(order_number=order_number) if cart_item_quantity.item_quantity > 1: cart_item_quantity.item_quantity -= 1 cart_item_quantity.product_price - cart_item_quantity.product_price cart_item_quantity.save() context = { 'cart_item_quantity': cart_item_quantity, } return render(request, 'Components/ProductToBuy.html' ,context) cart app : Product/Components/ProductToBuy.html: {% for cart_item in cart_items %} {{ cart_item.size }} {{ cart_item.product_name }} {{ cart_item.product_brand }} $ {{ cart_item.product_price }} {{ cart_item.item_quantity }} {% endfor %} cart app model: class Cart(models.Model): # user = models.ForeignKey(User, on_delete=models.CASCADE) product_name = models.CharField(max_length=255) product_brand = models.CharField(max_length=100) image_field = models.ImageField(upload_to='cart_images/') size = models.CharField(max_length=10) color = models.CharField(max_length=10) product_price = models.DecimalField(max_digits=10, decimal_places=2) item_quantity = models.PositiveIntegerField(default=1) order_number = models.IntegerField(unique=True) # No default random number here def __str__(self): return self.product_name
@ItsMe-vo1du
@ItsMe-vo1du 10 ай бұрын
it update in db , but the content in the templates does not
@oSpam
@oSpam 10 ай бұрын
@@ItsMe-vo1duyou’ll need a swap out of bands div that replaces the counter. Do you have discord or any other form or contact? I’m free to help if you’d like
@Septumsempra8818
@Septumsempra8818 10 ай бұрын
Does this work on scroll? When I'm scrolled down the page, i get both the scroll and the transition. Feels disorienting.
@bugbytes3923
@bugbytes3923 10 ай бұрын
I don't think this works on scroll, no. Not tested that though!
@Septumsempra8818
@Septumsempra8818 10 ай бұрын
@bugbytes3923 HTMX has a problem once pages need scroll. I've sorta fixed it with 'htmx.config.scrollBehaviour = "instant"' in a script tag in base.html this prevents the page from scrolling up to top of new page after settling the request, but doesn't allow a smooth view transition. "hx-swap show:windop:top" is supposed to prevent all thins from happening but it still scrolls. I don't know if it's a me-bug or an htmx problem.
@catalinim4227
@catalinim4227 10 ай бұрын
Sorry mate, but this isn't a page transition, You stayed on the same page. It's a content swap.
@Septumsempra8818
@Septumsempra8818 10 ай бұрын
🇿🇦🇿🇦🇿🇦🇿🇦
@deidyomega
@deidyomega 7 ай бұрын
I kinda wanna make a joke website using the most stupid page transitions now. Just go ham with it
@smyrnian_
@smyrnian_ 10 ай бұрын
This marks the official death of SPA apps :)
@DhavalAhir10
@DhavalAhir10 10 ай бұрын
Fastapi Tutorials.
HTMX-ify a Django list page!
8:35
BugBytes
Рет қаралды 9 М.
What services might you need when building a SaaS product?
13:58
Web Dev Cody
Рет қаралды 44 М.
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 16 МЛН
Little brothers couldn't stay calm when they noticed a bin lorry #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 20 МЛН
王子原来是假正经#艾莎
00:39
在逃的公主
Рет қаралды 8 МЛН
From React To HTMX
40:01
ThePrimeTime
Рет қаралды 322 М.
Multi-page application View Transitions are here
15:40
Chrome for Developers
Рет қаралды 13 М.
HTMX + GO 15 Minute Quickstart (For Javascript Devs)
16:59
developedbyed
Рет қаралды 22 М.
Jeremy McPeak's Larabits - HTMX May Be All You Need
15:22
Laracasts
Рет қаралды 11 М.
HTMX: 3 IRL Use Cases
18:33
ThePrimeTime
Рет қаралды 114 М.
You don't need a frontend framework
15:45
Andrew Schmelyun
Рет қаралды 120 М.
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 16 МЛН