\n

```

\n

How It Works:

\n

CSS Transitions: We apply a transition to smoothly change the background color. In this case, the box will smoothly transition its color when it reaches certain stages in the animation.

\n

CSS Animations: We use @keyframes to animate the boxโ€™s movement from left to right, changing its position and color at key stages (0%, 50%, and 100%).

\n

User Interaction: Clicking the button adds the animate class to the box, triggering the movement and color change. The animation takes 2 seconds to complete, and the background color smoothly transitions thanks to the transition property.

\n

This approach integrates both CSS transitions for smooth property changes and CSS animations for complex, multi-step movements. By combining them, you can create more engaging user interactions with minimal JavaScript, leveraging the power of CSS for visual effects.

\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
Become a Pro Slater User
\n\n\n\n","recentPosts":[{"id":7318105,"title":"๐Ÿ“ˆ Slater and marketing and data","slug":"slater-and-marketing-and-data","status":"published","readingTime":2,"campaignCompletedAt":"2024-11-22T23:42:53.000Z","publishedAt":"2024-11-22T23:42:53.000Z","orderByDate":"2024-11-22T23:42:53.000Z","timeAgo":"9 days","thumbnailUrl":"https://embed.filekitcdn.com/e/f2wTcXHNz6CCWc9a5vGTv3/83K6btRYEzGpKw3N7Ed3YS/email","thumbnailAlt":"","path":"posts/slater-and-marketing-and-data","url":"https://slater.kit.com/posts/slater-and-marketing-and-data","isPaid":null,"introContent":"๐Ÿ‘‹, In August, we launched a novel approach to a marketing site with ask.edgarallan.com. Since then, we've been focused on determining whether we built a winner or a loser by refining our data analytics capabilities. So far, the results look promising: check out this update. Alongside ask.ea, weโ€™re also enhancing our data analytics for Slater.app. What does that mean? Over the next several months, weโ€™ll be rolling out updates based on your feedback and user data. Stay tunedโ€”weโ€™ll share our...","campaignId":17366913,"publicationId":13912429},{"id":7244528,"title":"๐Ÿ“š Edgar Allan released a new book","slug":"edgar-allan-released-a-new-book","status":"published","readingTime":1,"campaignCompletedAt":"2024-11-15T21:34:27.000Z","publishedAt":"2024-11-15T21:34:27.000Z","orderByDate":"2024-11-15T21:34:27.000Z","timeAgo":"16 days","thumbnailUrl":"https://embed.filekitcdn.com/e/f2wTcXHNz6CCWc9a5vGTv3/vi7rPU2yfWxR3ACeZufzXM/email","thumbnailAlt":"","path":"posts/edgar-allan-released-a-new-book","url":"https://slater.kit.com/posts/edgar-allan-released-a-new-book","isPaid":null,"introContent":"Weโ€™re taking a break from our usual JavaScript content to share some exciting news: Edgar Allan has released a new book, How to Grow & Scale Your Business With Webflow. Created in collaboration with Webflow, this book is a must-read for anyone building a business with Webflow. Filled with insights from 3x Agency of the Year winner Edgar Allan, itโ€™s a playbook for individuals, pro-lancers, and small agencies growing alongside the revolutionary site-building platform. For our Slater users, we...","campaignId":17275642,"publicationId":13820005},{"id":7174182,"title":"๐Ÿคฒ Help us help you","slug":"help-us-help-you","status":"published","readingTime":2,"campaignCompletedAt":"2024-11-08T20:13:12.000Z","publishedAt":"2024-11-08T20:13:12.000Z","orderByDate":"2024-11-08T20:13:12.000Z","timeAgo":"23 days","thumbnailUrl":"https://embed.filekitcdn.com/e/f2wTcXHNz6CCWc9a5vGTv3/5JPAKp6PMbAzSfhn3hLd8x/email","thumbnailAlt":"","path":"posts/help-us-help-you","url":"https://slater.kit.com/posts/help-us-help-you","isPaid":null,"introContent":"Slater now has 7389 users. 2060 of you haven't created a file yet. ๐Ÿ˜ฑ These numbers got us thinking โ€“ we want to make Slater easier and more helpful to all #nocode developers.Weโ€™d love to hear from you: Did you find it challenging to get started with Slater? Are there specific areas where you could use more guidance? Do you use JavaScript often in your Webflow projects? Or is Slater your first time exploring custom code? What would help you feel more confident writing JavaScript in Slater? Are...","campaignId":17192404,"publicationId":13736524}],"newsletter":{"formId":4967504,"productId":null,"productUrl":null,"featuredPostId":null,"subscribersOnly":false},"isPaidSubscriber":false,"isSubscriber":false,"originUrl":"https://slater.kit.com/posts/smart-script-css","creatorProfileName":"Welcome To Slater!","creatorProfileId":1135261}๐Ÿ‘ฉ๐Ÿผโ€๐ŸŽจ Smart Script CSS

๐Ÿ‘ฉ๐Ÿผโ€๐ŸŽจ Smart Script CSS


โ€‹

โ€‹

Last week, we announced that CSS updates were on the wayโ€”and now they're here! You can now generate CSS files just as quickly and easily as JS files. In the video below, we give a quick demo of the new functionality. If you have a Smart Script loaded in your project, you can instantly add CSS.

In the demo, we also show how to add CSS in the Webflow designer. Give it a try and let us know what you're building!

โ€‹

video previewโ€‹

โ€‹

Community Library

๐Ÿ–๏ธ Text Highlight Colorโ€‹
CSS code for custom text selection.

๐Ÿ…ฐ Improved Font Renderingโ€‹
CSS for font smoothing, text rendering, and scroll behavior on the body element.

๐Ÿ“— Richtext Resetโ€‹
Removes top margin of the first and bottom margin of the last child elements in a rich text container.

โ€‹

Have you added a useful script to your library? Share it with us!

โ€‹

--

Javascript 101: CSS & JS Part II

In the last Javascript 101, we explored how to modify styles with JavaScript to create dynamic websites. We looked at manipulating inline styles, toggling CSS classes, and updating CSS variables to respond to user input. Each approach gave us a different level of control over styling changes, and by keeping animations smooth and maintainable, we can create interactive user experiences.

Now, letโ€™s combine what we learned last week with CSS transitions and animations. Weโ€™ll use CSS transitions for smooth property changes and @keyframes animations for more complex effects.

โ€‹

```
<style>
.box {
width: 100px;
height: 100px;
background-color: lightblue;
position: relative;
transition: background-color 0.5s ease; /* Transition for color changes */
}

@keyframes moveBox {
0% { left: 0; }
50% { left: 100px; background-color: tomato; } /* Color changes midway */
100% { left: 200px; background-color: skyblue; }
}

.animate {
animation: moveBox 2s forwards; /* Triggers the movement animation */
}
โ€‹
</style>
โ€‹
<button id="animateBtn">Animate Box</button>
<div id="box" class="box"></div>
โ€‹
<script>
const button = document.getElementById('animateBtn');
const box = document.getElementById('box');
button.addEventListener('click', () => {
box.classList.add('animate');
});
</script>

```

How It Works:

CSS Transitions: We apply a transition to smoothly change the background color. In this case, the box will smoothly transition its color when it reaches certain stages in the animation.

CSS Animations: We use @keyframes to animate the boxโ€™s movement from left to right, changing its position and color at key stages (0%, 50%, and 100%).

User Interaction: Clicking the button adds the animate class to the box, triggering the movement and color change. The animation takes 2 seconds to complete, and the background color smoothly transitions thanks to the transition property.

This approach integrates both CSS transitions for smooth property changes and CSS animations for complex, multi-step movements. By combining them, you can create more engaging user interactions with minimal JavaScript, leveraging the power of CSS for visual effects.

Happy coding!

โ€‹

๐Ÿค™ the Slater Team

โ€‹

โ€‹

If Slater helps you create better websites, please support the team behind it.

Welcome To Slater!

Slater resources, updates and community activity

Read more from Welcome To Slater!

๐Ÿ‘‹, In August, we launched a novel approach to a marketing site with ask.edgarallan.com. Since then, we've been focused on determining whether we built a winner or a loser by refining our data analytics capabilities. So far, the results look promising: check out this update. Alongside ask.ea, weโ€™re also enhancing our data analytics for Slater.app. What does that mean? Over the next several months, weโ€™ll be rolling out updates based on your feedback and user data. Stay tunedโ€”weโ€™ll share our...

Weโ€™re taking a break from our usual JavaScript content to share some exciting news: Edgar Allan has released a new book, How to Grow & Scale Your Business With Webflow. Created in collaboration with Webflow, this book is a must-read for anyone building a business with Webflow. Filled with insights from 3x Agency of the Year winner Edgar Allan, itโ€™s a playbook for individuals, pro-lancers, and small agencies growing alongside the revolutionary site-building platform. For our Slater users, we...

Slater now has 7389 users. 2060 of you haven't created a file yet. ๐Ÿ˜ฑ These numbers got us thinking โ€“ we want to make Slater easier and more helpful to all #nocode developers.Weโ€™d love to hear from you: Did you find it challenging to get started with Slater? Are there specific areas where you could use more guidance? Do you use JavaScript often in your Webflow projects? Or is Slater your first time exploring custom code? What would help you feel more confident writing JavaScript in Slater? Are...