Skip to the content

Preloader

A loading screen in the manner of the studio sites of the awards circuit, in cream and ink.

Become a member to unlock the full effect today.

Join now

Already a member? Sign in

Documentation

  1. Copy to Webflow

    Add Geist and Geist Mono to your site's fonts (Site settings, Fonts, Google Fonts) before pasting: Webflow removes any font your site has not installed.

  2. Add custom CSS

    The overlay covers the page from the first paint only if it comes first: keep it at the top of the Body, and if you move this code out of the Embed, put the CSS in the head of the page or of the site.
  3. Add custom JS

  4. Tune it

    Custom attributes
    Select the section on the canvas and open the Settings panel. Under Custom attributes, add a pair: the name on the left, the value on the right.
    Custom attributeWhat it does
    data-preloader Marks the overlay, the block that covers the page while it loads. It takes no value: leave the value field empty. Keep it first in the Body, so it covers the page from the first paint.
    data-preloader-panels Marks the layer of panels, one box per panel, any number of them, that lift off the page one after the other. Without it the overlay leaves with no lift, only the counter going out. [ Optional ]
    data-preloader-counter Marks the box the three figures leave through, upwards. Without it the digit boxes are looked for in the whole overlay. [ Optional ]
    data-preloader-digit Marks one digit box, three of them: hundreds, tens, units. The engine builds the strip of figures inside each, and a missing box itself. [ Optional ]
    data-preloader-label Marks a short line that fades out with the counter, top left in the preview. [ Optional ]
    data-preloader-note Marks a second short line that fades out with the counter, top right in the preview. [ Optional ]
    data-preloader-line Marks the progress hairline, filled from the left as the page loads. Without it nothing shows the progress but the digits. [ Optional ]
    data-preloader-intro On any element of the page, outside the overlay: hidden when the loader starts, raised into place one after the other as the panels lift, in page order. Without it the page is simply there under the curtain. It is a mark, not a setting: the time of the rise is data-preloader-intro-duration, on the overlay. [ Optional ]
    Settings
    Every setting is a custom attribute too, added the same way and on the same section. An attribute always wins over the defaults written in the code.
    AttributeDefaultWhat it is
    data-preloader-min 2.2 The shortest time the counter takes to reach 100, in seconds, even on a page that is already there.
    data-preloader-max 8 The longest the loader waits for the page before leaving anyway, in seconds.
    data-preloader-ceiling 90 Where the counter waits while the page is still loading, 0 to 100.
    data-preloader-roll 0.55 The time the digits take to roll from one step to the next, in seconds.
    data-preloader-hold 0.35 The pause on 100 before the curtain lifts, in seconds.
    data-preloader-exit 0.5 How long the figures take to leave through their window, in seconds.
    data-preloader-open 0.9 How long one panel takes to lift off the page, in seconds.
    data-preloader-open-stagger 0.08 Delay between two panels starting to lift, in seconds.
    data-preloader-open-ease power4.inOut Shape of the lift, where it speeds up and where it settles. Options: any GSAP ease, power4.inOut and expo.inOut for instance.
    data-preloader-lift clamp(24px, 4vh, 48px) How far an intro element travels up while it fades in, any CSS unit.
    data-preloader-intro-duration 1 How long one intro element takes to settle, in seconds.
    data-preloader-intro-stagger 0.08 Delay between two intro elements, in seconds.
    data-preloader-fade 0.35 Under reduced motion, how long the overlay takes to fade out, in seconds.
    data-preloader-once false Whether the loader plays once per browser session, and is skipped on the next pages. Options: false (every page), true (the first page of the session only).
    data-preloader-remove true Whether the overlay is taken out of the DOM once done. Options: true, false (it stays, hidden, and can be played again).
    data-preloader-label-loading Loading What is read out to a screen reader while the page loads. Options: any short phrase.
    data-preloader-label-done Loaded What is read out once the page is in. Options: any short phrase.

What it does

Preloader is a page transition for Webflow and vanilla JavaScript, built on GSAP 3. Also called odometer counter preloader, preloader counter animation or preloader 0 to 100.

A loading screen in the manner of the studio sites of the awards circuit, in cream and ink. On arrival, a screen of ink covers the cream page: a terminal label top left, a note top right, a giant three figure counter bottom right in cream and a hairline across the foot that fills in cream. The counter does not count, it rolls: each figure is a strip of digits sliding through a one line window, an odometer. It shows steps, not every number: 000, 031, 067, 100, each reached with a roll of the figures and held long enough to be read, while the hairline follows the load continuously. The pace is that of a real download, runs and pauses, never a straight line. The page holds it back: while the document, its fonts and its images are still coming in, the counter waits at 90, and it never shows 100 before the page is really there, within a shortest and a longest time. At 100 the figures leave upwards through their window, then the four panels lift off the page one after the other from the left, each one rolling up to its top edge like a blind, and the page brings its own content in under them: anything marked data-preloader-intro rises into place, and an event fires for the rest. Once played, the overlay is taken out of the DOM, the scroll is given back, and it can be set to play once per session. Under reduced motion the counter reads 100 at once and the overlay fades out as soon as the page is in.

Updated

Questions

Paste it and keep the overlay, the element marked data-preloader, first in the Body so it covers the page from the first paint. Its settings are custom attributes on that overlay, for instance data-preloader-min="3", and data-preloader itself takes no value.

No. The counter needs the GSAP 3 core, no plugins, and the embed loads 3.12.5, but the engine waits for it only up to max seconds, 8 by default, then takes the overlay off the page and warns in the console. If no script runs at all, the stylesheet lets the overlay go after twelve seconds.

Yes. The counter waits at ceiling, 90 by default, until the load event has fired, document.fonts is ready and every promise handed to wait() has settled, then runs to 100. The digits do not show every number: they roll through 000, 031, 067 and 100 while a hairline follows the load continuously.

Change data-preloader-min, the shortest time the counter takes to reach 100, 2.2 seconds by default. Lower and the loader is a flash where the digits barely roll, higher and it is a long, deliberate count. data-preloader-max caps how long it waits for a slow page before leaving anyway.

Yes, with data-preloader-once="true": only the first page of the browser session then shows the loader, where the default, false, plays it on every page. Load preloader.js right after the overlay, or in the head with defer, because the skip is decided when the engine runs.