Split-Flap Board
Departure board flipping characters to the word
How to use it
- Paste the HTML where the numbers & charts should appear.
- Add the CSS to your stylesheet. All classes are prefixed, so nothing clashes with your own styles.
- Add the JavaScript and call init() with the element that contains the HTML.
<!-- Split-Flap Board · NedDev · eigen werk. -->
<div class="jouw-container">
<div class="sfb" data-text="DEPARTURE"></div>
</div>/* Split-Flap Board · NedDev · eigen werk. */
.sfb{display:flex;gap:4px;justify-content:center;font:800 clamp(18px,4vw,38px)/1 'JetBrains Mono',monospace}
.sfb-cell{display:inline-flex;align-items:center;justify-content:center;width:1.1em;height:1.5em;background:#0a0a0a;color:#fff;border-radius:4px;position:relative;overflow:hidden}
.sfb-cell.on{color:#F5480F}// Split-Flap Board · NedDev · eigen werk.
// root = het element waarin de HTML staat
function init(root){
root=root.querySelector('.sfb')||root;var txt=root.dataset.text||'BOARD';root.textContent='';var glyphs='ABCDEFGHIJKLMNOPQRSTUVWXYZ ';var reduce=matchMedia('(prefers-reduced-motion:reduce)').matches;var cells=[];txt.split('').forEach(function(ch){var c=document.createElement('span');c.className='sfb-cell';c.textContent=ch===' '?'\u00a0':ch;root.appendChild(c);cells.push({el:c,target:ch});});if(reduce){cells.forEach(function(c){c.el.textContent=c.target===' '?'\u00a0':c.target;c.el.classList.add('on');});return;}cells.forEach(function(c,i){var steps=8+i*3,n=0;var iv=setInterval(function(){n++;if(n>=steps){clearInterval(iv);c.el.textContent=c.target===' '?'\u00a0':c.target;c.el.classList.add('on');return;}c.el.textContent=glyphs[Math.floor(Math.random()*glyphs.length)];},55);});
}
init(document.querySelector('.jouw-container'));
More numbers & charts
Seen something you like?
Add it to your selection and send it over. We build your site around it, in your brand.
Get in touch →