
Documentation
Webflow
Code
Setup: External Scripts
External Scripts in Webflow
Make sure to always put the External Scripts before the Javascript step of the resource.
In this video you learn where to put these in your Webflow project? Or how to include a paid GSAP Club plugin in your project?
HTML
Step 1: Copy structure to Webflow
Copy structure to Webflow
In the video below we described how you can copy + paste the structure of this resource to your Webflow project.
Copy to Webflow
Webflow structure is not required for this resource.
Step 1: Add HTML
HTML
<p>We have <span data-count-display="jobs">0</span> open positions</p>
<div class="grid" data-count-group="jobs">
<div class="grid-item" data-count-item></div>
<div class="grid-item" data-count-item></div>
<div class="grid-item" data-count-item></div>
<div class="grid-item" data-count-item></div>
<div class="grid-item" data-count-item></div>
</div>
HTML structure is not required for this resource.
Step 2: Add CSS
CSS
Step 2: Add custom Javascript
Custom Javascript in Webflow
In this video, Ilja gives you some guidance about using JavaScript in Webflow:
Step 2: Add Javascript
Step 3: Add Javascript
Javascript
function initDisplayCount() {
document.querySelectorAll('[data-count-group]').forEach(group => {
const name = group.dataset.countGroup;
const count = group.querySelectorAll('[data-count-item]').length;
const display = document.querySelector(`[data-count-display="${name}"]`);
document.querySelectorAll(`[data-count-display="${name}"]`).forEach(display => display.textContent = count);
});
}
// Initialize Display Count
document.addEventListener('DOMContentLoaded', () => {
initDisplayCount();
});
Step 3: Add custom CSS
Step 2: Add custom CSS
Custom CSS in Webflow
Curious about where to put custom CSS in Webflow? Ilja explains it in the below video:
CSS
Implementation
Attributes
- Add attribute
[data-count-group="name"]
to a parent element that wraps the items you want to count. - Add attribute
[data-count-item]
to elements inside the group that need to be counted. - Add attribute
[data-count-display="name"]
anywhere on the page to display the amount of elements in the group.
Matching names
Make sure to match the name [data-count-group="name"]
with the [data-count-display="name"]
to show the correct amount.
Multiple counts on one page
Because we match with names you can have multiple counts on one page, just give them a unique identifier. Example: [data-count-group="jobs"]
, [data-count-group="articles"]
& [data-count-group="services"]
Resource Details
Last updated
April 25, 2025
Type
Osmo Basics
Category
Utilities & Scripts
Need help?
Join Slack