cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="event-wrap">

  <div class="race-intro">
    <h1>100m Sprint</h1>
    <h2 class="animated zoomIn">Place yer bets!</h2>
    <button class="pistol">
      <i class="fa fa-spinner fa-spin"></i>
    </button>
  </div>

  <div class="window-reset hide animated flipInX">
    <i class="fa fa-trophy animated tada"></i>
    <ul id="result-list" class="result-list">
      <li id="result-1" class="result-1 animated flipInX">1<sup>st</sup> <span class="name"></span> <span class="time"></span></li>
      <li id="result-2" class="result-2 animated flipInX">2<sup>nd</sup> <span class="name"></span> <span class="time"></span></li>
      <li id="result-3" class="result-3 animated flipInX">3<sup>rd</sup> <span class="name"></span> <span class="time"></span></li>
    </ul>
    <button class="reset"><i class="fa fa-flag-checkered"></i> Reset</button>
  </div>

  <div class="race-wrap">

    <div id="race">
      <div class="start"></div>
      <div class="lane no1">
        <div class="runner no1">
          <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 233.1"><defs><style>.cls-1{fill:#fff;}</style></defs><title>runner</title><g id="ZL2Qc6.tif"><path d="M111.63,317.21c13,0.86,20.07-8.18,26.3-17.11a48.6,48.6,0,0,1,19.21-16.56c4.1-2,5.51-5.53,6.45-9.31,1.86-7.49,3.32-15.08,4.91-22.63a11.44,11.44,0,0,0,.25-3c-0.51-8.82.93-17.18,3.25-25.83,2.05-7.67.61-16.34,0.31-24.56-0.23-6.27-1.32-12.51-1.58-18.78-0.14-3.27-1.27-4.62-4.44-4.33-0.16,0-.33,0-0.5,0-5.41.37-12.94-1.35-15.79,1.54-6.05,6.13-10,14.48-14.13,22.3-2.05,3.9-3.14,8.2-.68,13.15,2.19,4.41-2.39,7.11-5.61,9.19-1.07.69-3.81,0-5.09-1-2.82-2.18-5-5.14-3.23-9,1.25-2.8,3.35-5.24,4.4-8.1,3.84-10.44,7.25-21,11.16-31.46,0.87-2.31,2.67-5.05,4.76-6a164.07,164.07,0,0,1,20.83-7.7c6.73-2,13.31-4.28,20.72-4.07,6.71,0.19,8.72-4.77,6.69-11.62-1.64-5.53-3.14-11.38,1.64-16.39,4.4-4.61,11.1-5.06,18.4-1.32,4.65,2.39,7.51,8.42,6.59,13.87-0.15.89-.66,2.23-0.27,2.63,5.38,5.4-1.45,9.83-1.21,14.81,0,0.36-2.22,1-3.46,1.22a25.63,25.63,0,0,0-4.8,1.09c8,2.37,8.71,8.68,8.82,15.07,0.09,5.16-.43,10.33-0.71,16.16,8.8-6.43,3-15.51,5.77-23.44,0.82,1.11,1.4,2,2.11,2.85s1.56,2.21,2.58,2.5c6.07,1.72,8.43,7.13,4.63,12.38-5.32,7.36-11.79,13.94-16.64,21.57-3.78,6-6,13-8.58,19.63-1.16,3-1.46,6.37-1.89,8.36,11.86,5.09,23.38,9.84,34.71,15,2.7,1.23,4.76,3.88,7.11,5.87v7c-3.29,4-6.3,8.37-9.92,12.09-7.08,7.28-14.64,14.09-21.74,21.35-6.28,6.41-6.76,10.54-2.4,18.44,1.73,3.12,4.21,5.82,6.16,8.84a6.32,6.32,0,0,1,1.16,3.9c-0.09.6-2.08,1.17-3.26,1.32-4.78.58-8.76-1.16-12.09-4.55-3.61-3.67-7.2-7.36-10.86-11-5.14-5.09-5-11,1.4-13.85,5.71-2.53,8.76-6.92,11.59-11.64,4.85-8.1,9.17-16.51,13.85-25-5.66.36-11.71,1.13-17.74,1-4.34-.11-6.46,1.53-8.39,5.23a190.51,190.51,0,0,1-11.85,20c-2.65,3.85-6.38,6.42-11.14,8.45-6.32,2.69-11.62,7.86-17.18,12.2-6.78,5.28-13.5,10.66-20,16.32-1.56,1.36-2,4-3,6-4.68,4.84-8.12,10.23-7.76,17.75,0.12,2.39-.56,4.83-0.88,7.24h-3c-3.7-7-5.83-14.28-5-22.34,0.23-2.16-.64-4.44-1-6.66v-9Z" transform="translate(-111.63 -122.11)"/><path class="cls-1" d="M111.63,326.21c0.37,2.22,1.24,4.5,1,6.66-0.84,8.06,1.29,15.35,5,22.34h-6v-29Z" transform="translate(-111.63 -122.11)"/></g></svg>
        </div>
      </div>
      <div class="lane no2">
        <div class="runner no2"><svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 233.1"><defs><style>.cls-1{fill:#fff;}</style></defs><title>runner</title><g id="ZL2Qc6.tif"><path d="M111.63,317.21c13,0.86,20.07-8.18,26.3-17.11a48.6,48.6,0,0,1,19.21-16.56c4.1-2,5.51-5.53,6.45-9.31,1.86-7.49,3.32-15.08,4.91-22.63a11.44,11.44,0,0,0,.25-3c-0.51-8.82.93-17.18,3.25-25.83,2.05-7.67.61-16.34,0.31-24.56-0.23-6.27-1.32-12.51-1.58-18.78-0.14-3.27-1.27-4.62-4.44-4.33-0.16,0-.33,0-0.5,0-5.41.37-12.94-1.35-15.79,1.54-6.05,6.13-10,14.48-14.13,22.3-2.05,3.9-3.14,8.2-.68,13.15,2.19,4.41-2.39,7.11-5.61,9.19-1.07.69-3.81,0-5.09-1-2.82-2.18-5-5.14-3.23-9,1.25-2.8,3.35-5.24,4.4-8.1,3.84-10.44,7.25-21,11.16-31.46,0.87-2.31,2.67-5.05,4.76-6a164.07,164.07,0,0,1,20.83-7.7c6.73-2,13.31-4.28,20.72-4.07,6.71,0.19,8.72-4.77,6.69-11.62-1.64-5.53-3.14-11.38,1.64-16.39,4.4-4.61,11.1-5.06,18.4-1.32,4.65,2.39,7.51,8.42,6.59,13.87-0.15.89-.66,2.23-0.27,2.63,5.38,5.4-1.45,9.83-1.21,14.81,0,0.36-2.22,1-3.46,1.22a25.63,25.63,0,0,0-4.8,1.09c8,2.37,8.71,8.68,8.82,15.07,0.09,5.16-.43,10.33-0.71,16.16,8.8-6.43,3-15.51,5.77-23.44,0.82,1.11,1.4,2,2.11,2.85s1.56,2.21,2.58,2.5c6.07,1.72,8.43,7.13,4.63,12.38-5.32,7.36-11.79,13.94-16.64,21.57-3.78,6-6,13-8.58,19.63-1.16,3-1.46,6.37-1.89,8.36,11.86,5.09,23.38,9.84,34.71,15,2.7,1.23,4.76,3.88,7.11,5.87v7c-3.29,4-6.3,8.37-9.92,12.09-7.08,7.28-14.64,14.09-21.74,21.35-6.28,6.41-6.76,10.54-2.4,18.44,1.73,3.12,4.21,5.82,6.16,8.84a6.32,6.32,0,0,1,1.16,3.9c-0.09.6-2.08,1.17-3.26,1.32-4.78.58-8.76-1.16-12.09-4.55-3.61-3.67-7.2-7.36-10.86-11-5.14-5.09-5-11,1.4-13.85,5.71-2.53,8.76-6.92,11.59-11.64,4.85-8.1,9.17-16.51,13.85-25-5.66.36-11.71,1.13-17.74,1-4.34-.11-6.46,1.53-8.39,5.23a190.51,190.51,0,0,1-11.85,20c-2.65,3.85-6.38,6.42-11.14,8.45-6.32,2.69-11.62,7.86-17.18,12.2-6.78,5.28-13.5,10.66-20,16.32-1.56,1.36-2,4-3,6-4.68,4.84-8.12,10.23-7.76,17.75,0.12,2.39-.56,4.83-0.88,7.24h-3c-3.7-7-5.83-14.28-5-22.34,0.23-2.16-.64-4.44-1-6.66v-9Z" transform="translate(-111.63 -122.11)"/><path class="cls-1" d="M111.63,326.21c0.37,2.22,1.24,4.5,1,6.66-0.84,8.06,1.29,15.35,5,22.34h-6v-29Z" transform="translate(-111.63 -122.11)"/></g></svg></div>
      </div>
      <div class="lane no3">
        <div class="runner no3"><svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 233.1"><defs><style>.cls-1{fill:#fff;}</style></defs><title>runner</title><g id="ZL2Qc6.tif"><path d="M111.63,317.21c13,0.86,20.07-8.18,26.3-17.11a48.6,48.6,0,0,1,19.21-16.56c4.1-2,5.51-5.53,6.45-9.31,1.86-7.49,3.32-15.08,4.91-22.63a11.44,11.44,0,0,0,.25-3c-0.51-8.82.93-17.18,3.25-25.83,2.05-7.67.61-16.34,0.31-24.56-0.23-6.27-1.32-12.51-1.58-18.78-0.14-3.27-1.27-4.62-4.44-4.33-0.16,0-.33,0-0.5,0-5.41.37-12.94-1.35-15.79,1.54-6.05,6.13-10,14.48-14.13,22.3-2.05,3.9-3.14,8.2-.68,13.15,2.19,4.41-2.39,7.11-5.61,9.19-1.07.69-3.81,0-5.09-1-2.82-2.18-5-5.14-3.23-9,1.25-2.8,3.35-5.24,4.4-8.1,3.84-10.44,7.25-21,11.16-31.46,0.87-2.31,2.67-5.05,4.76-6a164.07,164.07,0,0,1,20.83-7.7c6.73-2,13.31-4.28,20.72-4.07,6.71,0.19,8.72-4.77,6.69-11.62-1.64-5.53-3.14-11.38,1.64-16.39,4.4-4.61,11.1-5.06,18.4-1.32,4.65,2.39,7.51,8.42,6.59,13.87-0.15.89-.66,2.23-0.27,2.63,5.38,5.4-1.45,9.83-1.21,14.81,0,0.36-2.22,1-3.46,1.22a25.63,25.63,0,0,0-4.8,1.09c8,2.37,8.71,8.68,8.82,15.07,0.09,5.16-.43,10.33-0.71,16.16,8.8-6.43,3-15.51,5.77-23.44,0.82,1.11,1.4,2,2.11,2.85s1.56,2.21,2.58,2.5c6.07,1.72,8.43,7.13,4.63,12.38-5.32,7.36-11.79,13.94-16.64,21.57-3.78,6-6,13-8.58,19.63-1.16,3-1.46,6.37-1.89,8.36,11.86,5.09,23.38,9.84,34.71,15,2.7,1.23,4.76,3.88,7.11,5.87v7c-3.29,4-6.3,8.37-9.92,12.09-7.08,7.28-14.64,14.09-21.74,21.35-6.28,6.41-6.76,10.54-2.4,18.44,1.73,3.12,4.21,5.82,6.16,8.84a6.32,6.32,0,0,1,1.16,3.9c-0.09.6-2.08,1.17-3.26,1.32-4.78.58-8.76-1.16-12.09-4.55-3.61-3.67-7.2-7.36-10.86-11-5.14-5.09-5-11,1.4-13.85,5.71-2.53,8.76-6.92,11.59-11.64,4.85-8.1,9.17-16.51,13.85-25-5.66.36-11.71,1.13-17.74,1-4.34-.11-6.46,1.53-8.39,5.23a190.51,190.51,0,0,1-11.85,20c-2.65,3.85-6.38,6.42-11.14,8.45-6.32,2.69-11.62,7.86-17.18,12.2-6.78,5.28-13.5,10.66-20,16.32-1.56,1.36-2,4-3,6-4.68,4.84-8.12,10.23-7.76,17.75,0.12,2.39-.56,4.83-0.88,7.24h-3c-3.7-7-5.83-14.28-5-22.34,0.23-2.16-.64-4.44-1-6.66v-9Z" transform="translate(-111.63 -122.11)"/><path class="cls-1" d="M111.63,326.21c0.37,2.22,1.24,4.5,1,6.66-0.84,8.06,1.29,15.35,5,22.34h-6v-29Z" transform="translate(-111.63 -122.11)"/></g></svg></div>
      </div>
      <div class="lane no4">
        <div class="runner no4">
          <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 233.1"><defs><style>.cls-1{fill:#fff;}</style></defs><title>runner</title><g id="ZL2Qc6.tif"><path d="M111.63,317.21c13,0.86,20.07-8.18,26.3-17.11a48.6,48.6,0,0,1,19.21-16.56c4.1-2,5.51-5.53,6.45-9.31,1.86-7.49,3.32-15.08,4.91-22.63a11.44,11.44,0,0,0,.25-3c-0.51-8.82.93-17.18,3.25-25.83,2.05-7.67.61-16.34,0.31-24.56-0.23-6.27-1.32-12.51-1.58-18.78-0.14-3.27-1.27-4.62-4.44-4.33-0.16,0-.33,0-0.5,0-5.41.37-12.94-1.35-15.79,1.54-6.05,6.13-10,14.48-14.13,22.3-2.05,3.9-3.14,8.2-.68,13.15,2.19,4.41-2.39,7.11-5.61,9.19-1.07.69-3.81,0-5.09-1-2.82-2.18-5-5.14-3.23-9,1.25-2.8,3.35-5.24,4.4-8.1,3.84-10.44,7.25-21,11.16-31.46,0.87-2.31,2.67-5.05,4.76-6a164.07,164.07,0,0,1,20.83-7.7c6.73-2,13.31-4.28,20.72-4.07,6.71,0.19,8.72-4.77,6.69-11.62-1.64-5.53-3.14-11.38,1.64-16.39,4.4-4.61,11.1-5.06,18.4-1.32,4.65,2.39,7.51,8.42,6.59,13.87-0.15.89-.66,2.23-0.27,2.63,5.38,5.4-1.45,9.83-1.21,14.81,0,0.36-2.22,1-3.46,1.22a25.63,25.63,0,0,0-4.8,1.09c8,2.37,8.71,8.68,8.82,15.07,0.09,5.16-.43,10.33-0.71,16.16,8.8-6.43,3-15.51,5.77-23.44,0.82,1.11,1.4,2,2.11,2.85s1.56,2.21,2.58,2.5c6.07,1.72,8.43,7.13,4.63,12.38-5.32,7.36-11.79,13.94-16.64,21.57-3.78,6-6,13-8.58,19.63-1.16,3-1.46,6.37-1.89,8.36,11.86,5.09,23.38,9.84,34.71,15,2.7,1.23,4.76,3.88,7.11,5.87v7c-3.29,4-6.3,8.37-9.92,12.09-7.08,7.28-14.64,14.09-21.74,21.35-6.28,6.41-6.76,10.54-2.4,18.44,1.73,3.12,4.21,5.82,6.16,8.84a6.32,6.32,0,0,1,1.16,3.9c-0.09.6-2.08,1.17-3.26,1.32-4.78.58-8.76-1.16-12.09-4.55-3.61-3.67-7.2-7.36-10.86-11-5.14-5.09-5-11,1.4-13.85,5.71-2.53,8.76-6.92,11.59-11.64,4.85-8.1,9.17-16.51,13.85-25-5.66.36-11.71,1.13-17.74,1-4.34-.11-6.46,1.53-8.39,5.23a190.51,190.51,0,0,1-11.85,20c-2.65,3.85-6.38,6.42-11.14,8.45-6.32,2.69-11.62,7.86-17.18,12.2-6.78,5.28-13.5,10.66-20,16.32-1.56,1.36-2,4-3,6-4.68,4.84-8.12,10.23-7.76,17.75,0.12,2.39-.56,4.83-0.88,7.24h-3c-3.7-7-5.83-14.28-5-22.34,0.23-2.16-.64-4.44-1-6.66v-9Z" transform="translate(-111.63 -122.11)"/><path class="cls-1" d="M111.63,326.21c0.37,2.22,1.24,4.5,1,6.66-0.84,8.06,1.29,15.35,5,22.34h-6v-29Z" transform="translate(-111.63 -122.11)"/></g></svg>
        </div>
      </div>
      <div class="lane no5">
        <div class="runner no5">
          <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 233.1"><defs><style>.cls-1{fill:#fff;}</style></defs><title>runner</title><g id="ZL2Qc6.tif"><path d="M111.63,317.21c13,0.86,20.07-8.18,26.3-17.11a48.6,48.6,0,0,1,19.21-16.56c4.1-2,5.51-5.53,6.45-9.31,1.86-7.49,3.32-15.08,4.91-22.63a11.44,11.44,0,0,0,.25-3c-0.51-8.82.93-17.18,3.25-25.83,2.05-7.67.61-16.34,0.31-24.56-0.23-6.27-1.32-12.51-1.58-18.78-0.14-3.27-1.27-4.62-4.44-4.33-0.16,0-.33,0-0.5,0-5.41.37-12.94-1.35-15.79,1.54-6.05,6.13-10,14.48-14.13,22.3-2.05,3.9-3.14,8.2-.68,13.15,2.19,4.41-2.39,7.11-5.61,9.19-1.07.69-3.81,0-5.09-1-2.82-2.18-5-5.14-3.23-9,1.25-2.8,3.35-5.24,4.4-8.1,3.84-10.44,7.25-21,11.16-31.46,0.87-2.31,2.67-5.05,4.76-6a164.07,164.07,0,0,1,20.83-7.7c6.73-2,13.31-4.28,20.72-4.07,6.71,0.19,8.72-4.77,6.69-11.62-1.64-5.53-3.14-11.38,1.64-16.39,4.4-4.61,11.1-5.06,18.4-1.32,4.65,2.39,7.51,8.42,6.59,13.87-0.15.89-.66,2.23-0.27,2.63,5.38,5.4-1.45,9.83-1.21,14.81,0,0.36-2.22,1-3.46,1.22a25.63,25.63,0,0,0-4.8,1.09c8,2.37,8.71,8.68,8.82,15.07,0.09,5.16-.43,10.33-0.71,16.16,8.8-6.43,3-15.51,5.77-23.44,0.82,1.11,1.4,2,2.11,2.85s1.56,2.21,2.58,2.5c6.07,1.72,8.43,7.13,4.63,12.38-5.32,7.36-11.79,13.94-16.64,21.57-3.78,6-6,13-8.58,19.63-1.16,3-1.46,6.37-1.89,8.36,11.86,5.09,23.38,9.84,34.71,15,2.7,1.23,4.76,3.88,7.11,5.87v7c-3.29,4-6.3,8.37-9.92,12.09-7.08,7.28-14.64,14.09-21.74,21.35-6.28,6.41-6.76,10.54-2.4,18.44,1.73,3.12,4.21,5.82,6.16,8.84a6.32,6.32,0,0,1,1.16,3.9c-0.09.6-2.08,1.17-3.26,1.32-4.78.58-8.76-1.16-12.09-4.55-3.61-3.67-7.2-7.36-10.86-11-5.14-5.09-5-11,1.4-13.85,5.71-2.53,8.76-6.92,11.59-11.64,4.85-8.1,9.17-16.51,13.85-25-5.66.36-11.71,1.13-17.74,1-4.34-.11-6.46,1.53-8.39,5.23a190.51,190.51,0,0,1-11.85,20c-2.65,3.85-6.38,6.42-11.14,8.45-6.32,2.69-11.62,7.86-17.18,12.2-6.78,5.28-13.5,10.66-20,16.32-1.56,1.36-2,4-3,6-4.68,4.84-8.12,10.23-7.76,17.75,0.12,2.39-.56,4.83-0.88,7.24h-3c-3.7-7-5.83-14.28-5-22.34,0.23-2.16-.64-4.44-1-6.66v-9Z" transform="translate(-111.63 -122.11)"/><path class="cls-1" d="M111.63,326.21c0.37,2.22,1.24,4.5,1,6.66-0.84,8.06,1.29,15.35,5,22.34h-6v-29Z" transform="translate(-111.63 -122.11)"/></g></svg>
        </div>
      </div>
      <div class="finish"></div>
    </div>

  </div>

</div>
<!-- / event-wrap -->

<div class="made-by">
  A thing by <a href="http://ghosthorses.co.uk" target="_blank">Ghosthorses.co.uk</a>
</div>
            
          
!
            
              h1 {
  margin-bottom: 10px;
  padding: 0;
}

h2 {
  font-size: 13px;
  color: gray;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

button {
  background-color: green;
  border: 0;
  color: white;
  font-weight: bold;
  text-transform: uppercase;
  padding: 10px 15px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
  transform: translateY(0);
  &:hover {
    cursor: pointer;
    background: darken(green, 5%);
  }
  &:active,
  &:focus {
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transform: translateY(3px);
  }
}

.runner {
  transition: left 9.58s ease-in-out;
  @for $i from 1 through 5 {
    $rand: (random(100) / 100);
    &.no#{$i} {
      transition-duration: (9.58s + (1 * $rand));
      transition-timing-function: cubic-bezier(($rand * 100), ($rand * 100), ($rand / $rand), $rand);
    }
  }
}

.window-reset {
  position: absolute;
  overflow: hidden;
  width: 200px;
  font-size: 20px;
  top: 20%;
  height: 30%;
  left: 50%;
  margin-left: -130px;
  background: #f7f7f7;
  z-index: 6;
  text-align: center;
  padding: 30px;
  box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.1), 10px 10px 0 rgba(0, 0, 0, 0.05), -10px 10px 0 rgba(0, 0, 0, 0.05);
  &.show {
    display: block;
  }
  &.hide {
    display: none;
  }
}

.result-list {
  list-style-type: none;
  margin-left: 0;
  padding-left: 0;
  li {
    font-size: 15px;
    margin-bottom: 5px;
    
    sup {
      position: relative;
      top: 3px;
    }
  }
  li .name {
    &::before {
      font-weight: bold;
    }
    &.dude1::before {
      content: "Green Dude";
      color: green;
      text-transform: uppercase;
    }
    &.dude2::before {
      content: "Red Dude";
      color: red;
      text-transform: uppercase;
    }
    &.dude3::before {
      content: "Blue Dude";
      color: blue;
      text-transform: uppercase;
    }
    &.dude4::before {
      content: "Purple Dude";
      color: purple;
      text-transform: uppercase;
    }
    &.dude5::before {
      content: "Gray Dude";
      color: grey;
      text-transform: uppercase;
    }
  }
}

.reset {
  background-color: green;
  color: white;
  font-size: 13px;
  border: 0;
  padding: 5px 10px;
  position: relative;
  z-index: 1;
}

.race-wrap {
  position: relative;
  padding: 50px 10px 0;
  margin-top: 30px;
  
  @media screen and (min-width: 980px) {
    margin-top: 0;
    padding: 80px 30px 0;
  }
}

html {
  font-family: 'Josefin Sans', sans-serif;
}

.event-wrap {
  min-height: 500px;
  overflow-x: hidden;
  flex-direction: column;
  position: relative;
  padding: 2rem 0 3rem;
}

#race {
  position: relative;
  border: 1px solid black;
  border-bottom: 0;
}

.lane {
  border-bottom: 3px solid white;
  height: 3rem;
  padding: 0 20px;
  position: relative;
  background: #fb8036;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  svg {
    position: absolute;
    left: 0;
    bottom: 0;
  }
  &.no5 {
    border-bottom: 1px solid black;
  }
}

.runner {
  z-index: 5;
  top: 50%;
  margin-top: -15px;
  position: absolute;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  left: 1%;
  &.no1 svg {
    fill: green;
  }
  &.no2 svg {
    fill: red;
  }
  &.no3 svg {
    fill: blue;
  }
  &.no4 svg {
    fill: purple;
  }
  &.no5 svg {
    fill: grey;
  }
}

.start,
.finish {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  position: absolute;
  top: -60px;
  bottom: 0;
  padding: 0;
  z-index: 2;
  border-left: 1px solid #000;
  &::before,
  &::after {
    position: absolute;
    top: 0;
    padding: 5px 7px;
    border: 1px solid black;
    border-left: 0;
  }
}

.start {
  left: 30px;
  &::before {
    content: "Start";
  }
  
  @media screen and (min-width: 640px) {
    left: 40px;
  }
  
  @media screen and (min-width: 980px) {
    left: 50px;
  }
  
}

.finish {
  right: 30px;
  &::after {
    content: "Finish";
  }
  
  @media screen and (min-width: 640px) {
    right: 40px;
  }
  
   @media screen and (min-width: 980px) {
    right: 50px;
  }
}

.race-intro {
  text-align: center;
}

.fa-trophy {
  color: gold;
  font-size: 25px;
}

.result-1 {
  animation-delay: 1.2s;
}

.result-2 {
  animation-delay: 0.9s;
}

.result-2 {
  animation-delay: 0.6s;
}

.pistol {
  .fa {
    display: none;
  }
  &::before {
    content: "Go!";
  }
  &.running {
    background-color: transparent;
    padding: 10px;
    color: gray;
    box-shadow: none;
    border-radius: 100%;
    &:hover {
      cursor: default;
    }
    &::before {
      content: "";
    }
    .fa {
      display: block;
    }
  }
}

.made-by {
  letter-spacing: 1px;
  bottom: 20px;
  text-align: center;
  
  a {
    color: darken(#51bce8, 10%);
    
    text-decoration: none;
    
    &:hover {
      color: #51bce8;
    }
  }
}
            
          
!
            
              $(function() {
  //run when the DOM is ready

  var racetime = 9.58;
  var racetimeMS = parseFloat(racetime * 1000) + 2000; // FOR JS DELAYS
  var raceTimesArray = [];

  // RESET
  reset();

  // STARTER PISTOL
  $('.pistol').click(function() {

    $(this).queue("raceQueue", function(next) {

      // SET UP TIMES AND STUFF
      $('.runner').each(function(index) {
        var randNum = (Math.floor(Math.random() * 100) / 30);
        var runnerTime = (racetime + (1 * randNum)).toFixed(2);
        var runnerID = (index + 1);
        var runnerBundle = {
          runnerNumber: runnerID,
          runTime: runnerTime
        };
        $(this).css({
          "transition-duration": (runnerTime + "s")
        });
        raceTimesArray.push(runnerBundle); // Push Times to Array
       
      });

      next();

    }).queue("raceQueue", function(next) {

      // RUNNING SECTION

      // SET THE RUNNERS IN MOTION
      $('#race').addClass('go');

      // HEAD TO THE FINISH LINE
      $('.runner').css({
        "left": "96.3%"
      });

      // CHANGE THE MAIN TRIGGER
      $(this).prop("disabled", true).addClass('running');

      // Delay timer before next function
      setTimeout(function() {
        next();
      }, racetimeMS);

    }).queue("raceQueue", function(next) {

      // WHEN THE RACE HAS FINISHED

      // ORDER THE ARRAY INTO FASTEST TIMES
      raceTimesArray.sort(function(a, b) {
        return parseFloat(a.runTime) - parseFloat(b.runTime);
      });

      // PARSE ARRAY TO JSON
      var raceTimesJSON = $.parseJSON(JSON.stringify(raceTimesArray));

      // INJECT ARRAY DATA into HTML
      // 1st
      $('#result-1 .name').addClass('dude' + (raceTimesJSON[0].runnerNumber));
      $('#result-1 .time').html((raceTimesJSON[0].runTime) + 's');

      // 2nd
      $('#result-2 .name').addClass('dude' + (raceTimesJSON[1].runnerNumber));
      $('#result-2 .time').html((raceTimesJSON[1].runTime) + 's');

      // 3rd
      $('#result-3 .name').addClass('dude' + (raceTimesJSON[2].runnerNumber));
      $('#result-3 .time').html((raceTimesJSON[2].runTime) + 's');

      $('.window-reset').removeClass('hide').addClass('show');
      $(this).prop("disabled", true);

      next();

    }).dequeue("raceQueue");

  });

  // RESET FUNCTION
  function reset() {

    raceTimesArray.length = 0; // Empty Array
    $('#result-list li .name').removeClass('dude1 dude2 dude3 dude4 dude5'); // remove classes
    $('#result-list li .time').empty(); // remove content
    $('.window-reset').removeClass('show').addClass('hide');
    $('.pistol').prop("disabled", false).removeClass('running'); // Make it clickable
    $('.runner').css({
      "left": "1%",
      "transition-duration": "0s"
    });
  }

  $('.reset').click(function() {
    reset();
  });

});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console