jackpot 03

In this example below you will see how to do a jackpot 03 with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by benoitwimart, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright benoitwimart ©
  • HTML
  • CSS
  • JavaScript
    <button id="launch">GO ! </button>
<div class="numbers">
  <div id="one">
    <ul>
      <li>5</li>
      <li>1</li>
      <li>2</li>
      <li>3</li>
      <li>4</li>
      <li>5</li>
      <li>1</li>
    </ul>
  </div>

  <div id="two">
    <ul>
      <li>5</li>
      <li>1</li>
      <li>2</li>
      <li>3</li>
      <li>4</li>
      <li>5</li>
      <li>1</li>
    </ul>
  </div>

  <div id="three">
    <ul>
      <li>5</li>
      <li>1</li>
      <li>2</li>
      <li>3</li>
      <li>4</li>
      <li>5</li>
      <li>1</li>
    </ul>
  </div>
</div>

/*Downloaded from https://www.codeseek.co/benoitwimart/jackpot-03-gzvWdM */
    body{
  font-family:sans-serif;
}
#one,#two,#three{
  width:30px;
  height:30px;
  overflow:hidden;
  display:inline-block;
}
ul{
  margin:0;
  padding:0;
}

li{
  display:block;
  height:30px;
  line-height:30px;
  width:30px;
}


/*Downloaded from https://www.codeseek.co/benoitwimart/jackpot-03-gzvWdM */
    var button = document.querySelector("#launch");
var combi = ['111', '222', '333', '444', '555'];

button.addEventListener("click", function() {
  var randomCombi = combi[Math.floor(Math.random()*combi.length)]; 
  console.log(randomCombi);
  var tl = new TimelineMax();
  tl.to('ul',1,{color:'#000'});

  tl.to("#one ul", 5, {
    y: -600-Number(randomCombi[0])*30, 
    modifiers: {
      y: function(y) {
        var newY = y % 150; // 150 = 5 * 30
        return newY;
      }
    }
  },'-=1');

  tl.to("#two ul", 5, {
    y: -600-Number(randomCombi[1])*30, 
    modifiers: {
      y: function(y) {
        var newY = y % 150; // 150 = 5 * 30
        return newY;
      }
    }
  },'-=4.9');
  
    tl.to("#three ul", 5, {
    y: -600-Number(randomCombi[2])*30, 
    modifiers: {
      y: function(y) {
        var newY = y % 150; // 150 = 5 * 30
        return newY;
      }
    }
  },'-=4.9');
  
  tl.staggerTo('ul',.8,{color:'#fa0'},0.2);

});


Comments