🌍 Localization!


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 Timer
JavaScript code to dynamically update a progress bar based on time between two dates. From Digipop.

💗 Expand text on click
Toggle visibility of text sections with "Read More" buttons using JavaScript. From arrr_morgan.

Javascript 101: Greenhouse API

We've used the following really useful script from Ben Parker several times. The code dynamically fetches job data from a Greenhouse API and displays it on a webpage.

First, take a look at the code here: https://slater.app/community_library/greenhouse-43bbc514-8155-4df6-9fb0-61b8efe41639.
Now, let's break down the code.

  1. Global Object (domElements)
    • This object holds references to important DOM elements (e.g., the main container, loading indicator, job filter dropdown).
  2. Fetch Data Function (fetchData)
    • This function retrieves data from a given URL and returns it in JSON format. It handles errors if the data cannot be fetched.
  3. Filter Jobs (jobFilter.onchange)
    • When the user changes the filter dropdown, this code shows or hides job sections based on the selected filter value.
  4. Initialize Job Data (initJob Function)
    • Displays a loading indicator.
    • Fetches department data from the API.
    • Creates sections for departments with jobs, adds them to the page, and populates the filter dropdown.
  5. Write Job Listings (writeJobs Function)
    • Fetches job data for each department.
    • Updates the page with job listings under the correct department sections.
    • Hides the loading indicator and displays the main content once all jobs are loaded.

How It Works

  1. Page Load: initJob is called to start the process.
  2. Data Fetching: Departments and jobs are fetched from the API.
  3. DOM Updates: Sections and job listings are dynamically created and added to the page.
  4. User Interaction: The filter dropdown lets users choose which job sections to view.

You may not need this code now, but we've found Greenhouse to be a very common tool that our clients use. So, maybe in the future. See if you can follow how the code works. We'll discuss topics found in this script in future emails.

Your projects, supported by Slater

Slater served up Ben's Greenhouse script on iconiqcapital.com.

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!
photo

Do you get confused when undoing (cmd + z) in Slater? We auto-format your code on save. The auto-formatting updates your code, and those updates get pushed into the undo stack. You can now improve your workflow by formatting the code when you choose—not just on save. To gain more control over when your code formats: Turn off auto-format code in the Code Editor Settings Use cmd + shift + f to format your code We added a handful of other improvements: Console logs and debuggers are now...

video preview

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! Community Library 🖍️ Text Highlight ColorCSS code for custom text selection. 🅰...

Do you use Slater for CSS? CSS support in Slater has always been somewhat of an afterthought—JavaScript is our love language! But sometimes, you need a simple way to add CSS to your project. Maybe you want to write a complex grid or use a CSS property that Webflow doesn't support. That's why we've decided to make CSS a first-class citizen. We considered launching the new CSS functionality today, but we want to test it a bit more. Expect it early next week. To prepare for the launch, let's...