Map and motion

Preloader

A loading screen that covers the page until everything has loaded, then fades out. It never traps the visitor: it closes after 8 seconds at the latest, and it is hidden when JavaScript is off.

Example

Logo tile (default)

On a real page the preloader fills the whole screen. This preview uses .preloader--contained so it stays inside the box.

Homelia

Skyline

Seven buildings rise and fall one after another, with one brass tower in the middle. A good fit for an agency or developer brand.

Homelia

House outline

A house draws itself line by line, then the brass door appears and the drawing starts again. Calm and simple, with no logo needed.

Homelia

How to add it to a page

1. In the <head> script, add is-loading to the html element:

document.documentElement.classList.add('js', 'is-loading');

2. Right after <body>, add the markup:

<div class="preloader" data-preloader role="status" aria-label="Loading">
  <div class="preloader-inner">
    <span class="preloader-mark">...icon...</span>
    <span class="preloader-name">Homelia</span>
    <span class="preloader-bar" aria-hidden="true"></span>
  </div>
</div>

Every page of the template already includes it.

To use the skyline or the house instead of the logo tile, replace what is inside .preloader-inner with the markup from that example. Keep the outer .preloader element and its data-preloader attribute as they are. site.js works the same for all three styles.

3. site.js does the rest. It waits for the page to load (at least 0.6 seconds, so it does not flash), fades the screen out and removes it. It then fires a preloader:done event. The hero animation waits for that event, so it plays after the screen has gone.

Classes and attributes

NamePurpose
.preloader + data-preloaderThe full-screen cover. The attribute tells site.js to manage it.
.preloader-mark, -name, -barLogo tile with a spinning ring, brand name and a moving bar.
.preloader-skylineSkyline style. Holds seven empty <i> elements, one per building.
.preloader-house, -house-line, -house-doorHouse outline style: the box, the outline that draws itself and the brass door.
.preloader--containedFills its parent instead of the screen. For demos.
html.is-loadingStops the page from scrolling while the screen is shown.
.is-doneAdded when loading ends. Fades the screen out.