JavaScript Inside Webflow Components

  Рет қаралды 5,182

Timothy Ricks

Timothy Ricks

Күн бұрын

Пікірлер: 31
@TheM4dPatter
@TheM4dPatter 4 ай бұрын
Timothy this is unreal, excellent thinking here.
@timothyricks
@timothyricks 4 ай бұрын
Thanks so much!
@fpv_jesus
@fpv_jesus 4 ай бұрын
Wow. Not even 24 hours this was the exact problem I was having. You’re a absolute superhero
@DANNYFIGDESIGNS
@DANNYFIGDESIGNS 4 ай бұрын
It keeps getting better and better. 🎉
@timothyricks
@timothyricks 4 ай бұрын
Thank you!!
@MatthewBegnoche
@MatthewBegnoche 4 ай бұрын
So helpful! Thanks!
@martinhudobivnik5895
@martinhudobivnik5895 4 ай бұрын
Beautiful. I tried to make this work a while back, but gave up after the duplication problem.
@timothyricks
@timothyricks 4 ай бұрын
Thank you! The load order part was the tricky part for me.
@denniskarg
@denniskarg 4 ай бұрын
All the years and current best practices have taught that tags with regular HTML content should be avoided. Every time the browser encounters a tag, the parsing of the HTML is interrupted, regardless of whether the script is inline or external, read-only or executed. I feel for you Timothy, finding a solution to load scripts only when the appropriate elements are present, but I don't think that's the solution. Much respect to you! 🤝
@timothyricks
@timothyricks 4 ай бұрын
Thank you, Dennis! I just added defer to each script tag so DOM Parsing is not blocked. It's similar to including script tags in the head with defer set.
@denniskarg
@denniskarg 4 ай бұрын
Unfortunately, this is ignored by browsers at this point. The defer attribute only works for scripts whose content is loaded via src="", not for inline scripts. 😬
@timothyricks
@timothyricks 4 ай бұрын
@@denniskarg Oh, I see! Thank you! Would the next best thing be a DOMContentLoaded so that the everything inside the script isn't parsed until the DOM renders?
@denniskarg
@denniskarg 4 ай бұрын
Unfortunately no, that wouldn't help. The problem lies with the tag itself, regardless of what it contains. If possible, load external scripts in the with the defer attribute and always place inline scripts in the before . What you want to achieve is more likely to work with JavaScript modules to load scripts, for example, if case XYZ applies (e.g. element present on the page). However, this is not something that can be done just like that and I would only recommend it if performance needs to be improved if it turns out to be a problem.
@timothyricks
@timothyricks 4 ай бұрын
​@@denniskarg Thank you for all the really helpful feedback! I might store each embed in a component separate from its section so that embeds can be added at the very bottom of the body, letting all html get parsed first. If we were to store all scripts externally, then we could dynamically load in scripts based on the sections used on that page. But if it's at all possible, keeping the scripts in Webflow seems like the best solution. This is a problem that really needs to be solved before Page Building mode is released, and this solution is the best I found so far for solving it.
@harelpanker
@harelpanker 4 ай бұрын
Nice!
@corneromme
@corneromme 4 ай бұрын
Love this! Feels a bit like using a js framework where all html, css and js is grouped per component. One question though: if I’m using Barba js for page transitions, would this still work for components that aren’t on the homepage? Since you’re never actually reloading the page when changing pages.
@timothyricks
@timothyricks 4 ай бұрын
Thank you! You're right that this wouldn't work with Barba.js as is. We would need to remove all functions from pageFunctions before the new container enters and then execute functions after the new container enters like this. timothyricks.notion.site/Page-Functions-With-Barba-js-948df85dca2f4a399e98c32e0ec5ea79?pvs=4
@corneromme
@corneromme 4 ай бұрын
Can't thank you enough! Using an IIFE to add this function to the window object is actually ingenious!!
@btcmartinschulze-schilddor2753
@btcmartinschulze-schilddor2753 4 ай бұрын
First of all, great video! Thank you for your support in the community. Quick question (a bit off-topic..): I saw that in your video, when you selected your "section hero" component, your properties panel had pre-defined tags like "light" "dark" "inverted", etc. directly under the text input field. How did you do that? And how does it work?
@timothyricks
@timothyricks 4 ай бұрын
Thanks so much! I created a Chrome Extension that adds those component buttons based on different values in our embed. This tutorial shows how it works and how to set it up. kzbin.info/www/bejne/pWXconuCacdsZpYsi=qQyMlYKgC5bjLW5Q&t=59
@btcmartinschulze-schilddor2753
@btcmartinschulze-schilddor2753 4 ай бұрын
@@timothyricks Oh wow, that sounds nice! I'll check it out. Thank you!! :)
@HalZeitlin
@HalZeitlin 4 ай бұрын
Are there times it makes sense to send an email notifications when there's a serious code error, or is just better to wait and let it be broken until someone flags. Sometimes as new pages are stood up, things can miss QA.
@timothyricks
@timothyricks 4 ай бұрын
That could be a helpful feature! I'm just not sure yet how we would prevent the email from sending for each user that visits the site.
@edanjumbo
@edanjumbo 4 ай бұрын
Hi Timothy, which of your videos would you recommend I watch to learn the Lumos framework? It seems a bit confusing
@timothyricks
@timothyricks 4 ай бұрын
Hi Edan, I just released a crash course for learning Lumos here. kzbin.info/aero/PLoXSZEwtbyStInsfWsEO5ouJ7HTfMMLeA&si=6J0pGYXLJNGZs0qn
@LukeHallickII
@LukeHallickII 3 ай бұрын
Hi Tim! Sorry for all my questions lately. I'm trying to transition from your old tutorial on swiper.js to this component nested method and I can't get it to work properly. I'm wondering if this has to do with Swiper updating to V11 from V8 or maybe I'm not properly copying and pasting the script from the page's body tag into the component embed? I also have the CSS linked in the head tag of the page still?
@timothyricks
@timothyricks 3 ай бұрын
All good! Yes, the css should still be in the site settings head code The swiper js link should be the first line of code in the site settings footer code. I would check for console errors just in case some code isn’t being added correctly in the embed.
@jpthedio
@jpthedio 4 ай бұрын
If the library scripts are defered, would it work? :)
@martinhudobivnik5895
@martinhudobivnik5895 4 ай бұрын
Tried it, as expected that doesn't work.
Top 5 Webflow Mistakes
7:26
Timothy Ricks
Рет қаралды 13 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 9 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
Интересно, какой он был в молодости
01:00
БЕЗУМНЫЙ СПОРТ
Рет қаралды 3,6 МЛН
CSS Animations in Webflow
10:02
Timothy Ricks
Рет қаралды 15 М.
GSAP & ScrollTrigger Crash Course for Webflow
16:09
Timothy Ricks
Рет қаралды 43 М.
Webflow + Javascript: 3 Tips To Improve Your Code!
10:55
Mike Pecha
Рет қаралды 8 М.
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 1,1 МЛН
THIS PORTFOLIO IS INSANE - Roasting your dev sites #3
17:59
Anthony Sistilli
Рет қаралды 139 М.
Master Webflow Interactions: 2024 Crash Course for Beginners
18:00
Timothy Ricks
Рет қаралды 19 М.
Build smarter with Webflow components
43:35
Webflow
Рет қаралды 9 М.
Webflow Pricing Explained (Hosting & Workspace plans 2024)
8:33
Sam Harrison
Рет қаралды 12 М.
The Death of Flexbox in Webflow
22:19
Timothy Ricks
Рет қаралды 8 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 9 МЛН