\n

3. Initialize the Library

\n

Once the library is added, you can begin leveraging its features within your Webflow project. Start with a very basic example. For instance, let's create a simple animation using GSAP and trigger it on a button click:

\n

// GSAP Animationโ€‹
const button = document.querySelector('.my-button');
button.addEventListener('click', () => {
gsap.to('.my-element', { duration: 1, x: 100, opacity: 0 });
});

\n

4. Add Additional Features

\n

After getting a basic implementation of the library working in your Webflow project, start to explore and add additional configurations and functionality. Review the documentation and iterate as needed, making adjustments or optimizations based on testing results to ensure optimal performance.

\n

// GSAP Animationโ€‹
const button = document.querySelector('.my-button');
const elements = document.querySelectorAll('.my-element');
โ€‹
button.addEventListener('click', () => {
gsap.from(elements, {
duration: 1,
x: -100,
opacity: 0,
stagger: 0.2,
ease: \"power2.out\"
});
});

\n

5. Finalize Your Implementation

\n

Once you have the implementation working correctly, revisit the code and refactor it. Remove any dead code and simplify the remaining code. Document where needed for yourself and future collaborators.

\n

--

\n

Call to Action

\n

This weekend, try implementing a new JS library in your project, and share your favorite JS libraries with us. We'll use your favorite libraries for future JavaScript tutorials.

\n

Happy coding!

\n

โ€‹

\n

๐Ÿค™ The Slater team

\n
\n

โ€‹

\n

๐Ÿ™ If Slater helps you create better websites, please support the team behind it.

\n\n\n\n
\n\n
\n\n\n\n
\n
Get A Paid Plan
\n

โ€‹
โ€‹
1295 Canyon View Rd, Midway, UT 84049
โ€‹Unsubscribe ยท Preferencesโ€‹

\n
\n
\n\n\n\n

โ€‹

\n\n\n","recentPosts":[{"id":6200271,"title":"๐ŸŒ Localization!","slug":"localization","status":"published","readingTime":1,"campaignCompletedAt":"2024-07-26T23:32:10.000Z","publishedAt":"2024-07-26T23:32:10.000Z","orderByDate":"2024-07-26T23:32:10.000Z","timeAgo":"about 9 hours","thumbnailUrl":"https://embed.filekitcdn.com/e/f2wTcXHNz6CCWc9a5vGTv3/abSpS6rN9ju3YawgEDCoj5/email","thumbnailAlt":"","path":"posts/localization","url":"https://slater.ck.page/posts/localization","isPaid":null,"introContent":"Are you using Webflow localization? We've received several requests to provide better support for it, so we're working on an update. I just finished writing the code. We need to do some testing before releasing the update early next week. Community library scripts โฏ๏ธ Pause/Reset Video Embed on Click Stops all iframe videos by resetting their source on '.close-video' button click. From Corey Moen. โฐ Progress Bar TimerJavaScript code to dynamically update a progress bar based on time between...","campaignId":16006647,"publicationId":12536153},{"id":6139416,"title":"๐Ÿš€ GPT 4o mini out now","slug":"gpt-4o-mini-out-now","status":"published","readingTime":1,"campaignCompletedAt":"2024-07-19T19:24:46.000Z","publishedAt":"2024-07-19T19:24:46.000Z","orderByDate":"2024-07-19T19:24:46.000Z","timeAgo":"8 days","thumbnailUrl":"https://embed.filekitcdn.com/e/f2wTcXHNz6CCWc9a5vGTv3/kPPRtLPKdkkebriLp1xGUJ/email","thumbnailAlt":null,"path":"posts/gpt-4o-mini-out-now","url":"https://slater.ck.page/posts/gpt-4o-mini-out-now","isPaid":null,"introContent":"The AI world moves fast, and we are keeping up. This week, OpenAI released a new model, GPT 4.o mini. GPT 4.0 mini is an improved, cost-effective model that we are supporting under Slater's free tier. The default Slater AI will continue to be powered by GPT 3.5 as we test GPT 4.0 mini, but you can configure GPT 4.0 mini or even GPT 4.0 (paid) today. Community library scripts ๐Ÿ“ Fix Paragraph Runts With Nonbreaking SpacePrevent single-word runts in HTML elements with the class `.no-runt`. From...","campaignId":15934295,"publicationId":12461554},{"id":6081252,"title":"๐Ÿค” Math?","slug":"math","status":"published","readingTime":3,"campaignCompletedAt":"2024-07-12T19:49:06.000Z","publishedAt":"2024-07-12T19:49:06.000Z","orderByDate":"2024-07-12T19:49:06.000Z","timeAgo":"15 days","thumbnailUrl":"https://pbs.twimg.com/ext_tw_video_thumb/1711498778912477184/pu/img/2aoZ-UYrcrw8hq6Q.jpg","thumbnailAlt":null,"path":"posts/math","url":"https://slater.ck.page/posts/math","isPaid":null,"introContent":"We're back from a company-wide summer pause (or winter pause for our Southern Hemisphere team members). Edgar Allan is hitting it's numbers! Let's look at some new Community Library scripts: ๐Ÿ‘€ Dynamically loads HTML content based on a random number. This is a quick script we wrote to give a dynamic intro into a soon-to-be-released https://edgarallan.com. https://slater.app/community_library/random-content-aee7f7f2-3ab8-4e6f-887e-ea54cad0ebbf From Jared Malan โœ๏ธ Create a variable for your...","campaignId":15863018,"publicationId":12388397}],"newsletter":{"formId":4967504,"productId":null,"productUrl":null,"featuredPostId":null,"subscribersOnly":false},"isPaidSubscriber":false,"isSubscriber":false,"originUrl":"https://slater.ck.page/posts/thanks-for-sharing-slater-app","creatorProfileName":"Welcome To Slater!","creatorProfileId":1135261}Thanks for sharing Slater.app ๐Ÿ™

Thanks for sharing Slater.app ๐Ÿ™


๐Ÿ‘‹,

โ€‹

โ€‹

โ€‹

On Sunday, @ransegall shared an issue he had with CodeSandbox. Several of you responded with helpful comments suggesting Slater.app as a good solution for Ran.

Thank you for doing that @HalZeitlin, @josiahduenes, @jeffamcavoy, @andressentis, @DMendoza1999, @jarekkowalczyk, @adidascal, @JoaoPSoliva, @etybura, and anyone we may have missed for .

And welcome to the fold, Ran! Let us know what you build.


More scripts!

Next week, we will give you more control over your Slater scripts. While the existing single script functionality will remain unchanged, you'll now have the option to include single-page scripts. Additionally, you'll have staging or production-only scripts, providing you control over the scope and load events of your JavaScript.

Witt will be recording a Slater.app Sessions video to thoroughly explain this functionality.


Javascript 101: JS Libraries in Webflow

JavaScript libraries play a crucial role in providing functionality and interactivity to Webflow projects. They make learning JavaScript worthwhile. Whether you want to create smooth animations, implement scroll interactions, or add dynamic elements to your site, leveraging an existing JS library is a wise choice.

Let's explore a framework for implementing JavaScript libraries in your Webflow projects, using examples from commonly used libraries.

1. Understand the Library's Purpose and Documentation

Before diving into implementation, take the time to understand the purpose and features of the JavaScript library you intend to use. Find the documentation, explore a demo, and get familiar with the library's capabilities and limitations.

2. Add the Library to Your Project

Begin by adding the JavaScript library to your Webflow project. This typically involves including the library's JavaScript file directly or linking to it from a Content Delivery Network (CDN). You can often add a CDN directly as a Slater external script, but sometimes, like with GSAP, you need to add it directly to Webflow.

<!-- GSAP -->โ€‹
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js"></script>

3. Initialize the Library

Once the library is added, you can begin leveraging its features within your Webflow project. Start with a very basic example. For instance, let's create a simple animation using GSAP and trigger it on a button click:

// GSAP Animationโ€‹
const button = document.querySelector('.my-button');
button.addEventListener('click', () => {
gsap.to('.my-element', { duration: 1, x: 100, opacity: 0 });
});

4. Add Additional Features

After getting a basic implementation of the library working in your Webflow project, start to explore and add additional configurations and functionality. Review the documentation and iterate as needed, making adjustments or optimizations based on testing results to ensure optimal performance.

// GSAP Animationโ€‹
const button = document.querySelector('.my-button');
const elements = document.querySelectorAll('.my-element');
โ€‹
button.addEventListener('click', () => {
gsap.from(elements, {
duration: 1,
x: -100,
opacity: 0,
stagger: 0.2,
ease: "power2.out"
});
});

5. Finalize Your Implementation

Once you have the implementation working correctly, revisit the code and refactor it. Remove any dead code and simplify the remaining code. Document where needed for yourself and future collaborators.

--

Call to Action

This weekend, try implementing a new JS library in your project, and share your favorite JS libraries with us. We'll use your favorite libraries for future JavaScript tutorials.

Happy coding!

โ€‹

๐Ÿค™ The Slater team


โ€‹

๐Ÿ™ If Slater helps you create better websites, please support the team behind it.

โ€‹
โ€‹
1295 Canyon View Rd, Midway, UT 84049
โ€‹Unsubscribe ยท Preferencesโ€‹

โ€‹

Welcome To Slater!

Slater resources, updates and community activity

Read more from Welcome To Slater!

Are you using Webflow localization? We've received several requests to provide better support for it, so we're working on an update. I just finished writing the code. We need to do some testing before releasing the update early next week. Community library scripts โฏ๏ธ Pause/Reset Video Embed on Click Stops all iframe videos by resetting their source on '.close-video' button click. From Corey Moen. โฐ Progress Bar TimerJavaScript code to dynamically update a progress bar based on time between...

The AI world moves fast, and we are keeping up. This week, OpenAI released a new model, GPT 4.o mini. GPT 4.0 mini is an improved, cost-effective model that we are supporting under Slater's free tier. The default Slater AI will continue to be powered by GPT 3.5 as we test GPT 4.0 mini, but you can configure GPT 4.0 mini or even GPT 4.0 (paid) today. Community library scripts ๐Ÿ“ Fix Paragraph Runts With Nonbreaking SpacePrevent single-word runts in HTML elements with the class `.no-runt`. From...

We're back from a company-wide summer pause (or winter pause for our Southern Hemisphere team members). Edgar Allan is hitting it's numbers! Let's look at some new Community Library scripts: ๐Ÿ‘€ Dynamically loads HTML content based on a random number. This is a quick script we wrote to give a dynamic intro into a soon-to-be-released https://edgarallan.com. https://slater.app/community_library/random-content-aee7f7f2-3ab8-4e6f-887e-ea54cad0ebbf From Jared Malan โœ๏ธ Create a variable for your...