Mon Oct 22 2018
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
<div class="rto-wrap">

  <div class="rto-container">
    
      <div class="rto-header">
        IF YOU ORDER IN THE NEXT TEN MINUTES:
      </div>
      
      <div class="rto-body">
        
        <div class="offer-price">
          <h3>save an additional</h3>
          <div class='rto-offer-price'>$10</div>
          <h3>on your order</h3>
        </div> <!-- /offer-price -->

        <div class="progress-bar">
          <div id="svgcontainer">
            <svg height="300" width="300" id="svg">
              <circle id="progressbg" cx="150" cy="150" r="120" stroke-width="10" fill="transparent" stroke-dasharray="753.9822368615503" />
              <circle id="progress" cx="150" cy="150" r="120" stroke-width="10" fill="transparent" stroke-dasharray="753.9822368615503" />
            </svg>

            <div class="countdown-clock">

              <div class='timeleft'>

                <div id='hours'>
                  <div class="digits">
                    <span class="digit"></span>
                    <span class="word-mobile">m</span>
                  </div>
                  <div class="word">Hours</div>
                </div>

                <div class='colon'>:</div>

                <div id='minutes'>
                  <div class="digits">
                    <span class="digit">09</span>
                    <span class="word-mobile">m</span>
                  </div>        
                  <div class="word">Minutes</div>
                </div>

                <div class='colon'>:</div>

                <div id='seconds'>
                  <div class="digits">
                    <span class="digit">09</span>
                    <span class="word-mobile">s</span>
                  </div>
                  <div class="word">Seconds</div>
                </div>      

              </div>       
            </div>
          </div>
        </div> <!--/ progress-bar -->
      </div> <!-- /rto-body -->
      
      <div class="rto-footer">
        <a href="">SHOP NOW</a>
      </div>

      <div class="rto-gradient"></div>

  </div>
</div>


<style>


  /* White blurry backgorund */
  .rto-gradient {
      display: none;
      background: pink;
      width: 100%;
      height: 100%;
      left: 0;
      top: 0;
      position: absolute;
      background: rgba(255,255,255,0.8);
      z-index: 1;   
  }

  /*  used to center rto container */
  .rto-wrap {    
      position: absolute;
      top: 0; 
      left: 0;
      height: 100%;
      width: 100%;
      text-align: center;
      z-index: 100;
      background: rgba(255,255,255,0.8);
  }





  .rto-container {
    z-index: 150009999999;
    text-align:center;
    max-width: 650px;
    background: #363635;  
    margin: 10vh auto;
  }

  .rto-header {
    background: #EAB726;
    padding: 2.2em 1em;
  }

  .rto-body {  
    display: flex;
    color: #fff;
    padding: 2em 3em;
  }

  .rto-body > * {
    width: 50%;
  }

  .rto-body .offer-price {
    text-transform: uppercase;
    order: 1;
    margin-top: 2em;
  }

  .rto-body h3 {
    font-weight: lighter;
  }

  .rto-offer-price {
    font-weight: 100;
    font-size: 102px;
  }

  .rto-footer {
    padding: 0 0 2em 0;
  }

  .rto-footer a {
    background: #34A4D9;
    display: inline-block;
    color: #fff;
    padding: 1em 6em;
    text-decoration: none;
    font-weight: 500;
    border-radius: 4px;
  }




  .timeleft {
    display: table;
    width: 100%;
    align-items: center;
    font-size: 28px;
    
  }

  .timeleft > div {
    display: table-cell;
    font-size: 52px;
    
  }

  #hours, #hours + .colon {
    display: none;
  }

  .digits {
    display: table;
  }

  .digits > span {
    display: table-cell;
    text-align: center;
    font-weight: 700;
    width: 100px;
  }

  .digits > span:last-of-type {
    font-size: 70%;
    margin: 0 auto;
    width: 1px;
    overflow: hidden;
    display: block;
    font-weight: 100;
    
  }
  .word {
    font-size: 10px;
    text-transform: uppercase;
  }

  .word-mobile {
    display: none;
  }


  .countdown-clock {
    width: 60%;
    text-align: center;
    position: absolute;
    top: 97px;
    left: 20%;
    font-size: 42px;
    font-weight: 100;
    color: #fff;
    transition: all 1s linear;
    /*transform: rotate(90deg);*/
  }

  #svgcontainer{
    position: relative;
    display: inline-block;
    width: 300px;	
  }

  #svg{
    position:relative;
    transform: rotate(90deg);
  }

  #progressbg {
    z-index:0;
    position:absolute;
    top:0px;
    box-shadow: 5px 5px 5px 5px #333;
    stroke: #2B2B2A;
  }

  #progress {
    stroke-dashoffset: 0;
    stroke: #2769BF;
    transition: all 1s linear;
    z-index:1;
    position:absolute;
    top:0px;  
    

  }




  @media (max-width: 650px) {
    
    .rto-container {
      max-width: 355px;
      margin: 1em auto;
      border-radius: 5px;
    }
    
  
    .rto-header {
      padding: 2em 0;
      border-top-left-radius: 5px;
      border-top-right-radius: 5px;
    }
    .rto-body {
      flex-direction: column;
      padding: 0;
    }
    
    .rto-body > * {
      width: 100%;
    }
    .rto-body .offer-price {
      order: 1; 
      margin-top: 1em;
      line-height: 59px;
    }
    
    .rto-body h3 {
      margin: 0;
    }
    
    .rto-body .progress-bar {
      order: 2;
      height: 267px;
      overflow: hidden;
    }

    .countdown-clock {
      top: 91px;
      left: 26%;
      width: 57%;
    }
    
    .word {
      display: none;
    }

    .digits > span:last-of-type {
      display: inline-block;
      width: auto;
      position: relative;
      bottom: -10px;
    }
    .digit {
      width: 50%!important;
    }

    #seconds .digits > .digit {
      width: 75%!important;
    }
    .colon {
      display: none!important;
    }
    .timeleft > div {
      font-size: 42px;
    }

    .rto-footer a {
      padding: 0.5em 6em;
    }
  }





  @keyframes colorfade {
    0% {
      stroke: #2769BF
    }
    
    25% {
      stroke: #EAB726;
      
    }
    
    
    40% {
      stroke: #d45322f2
      
    }
    
    75% {
      
    }
    100% {
      stroke: #d41818
    }
  }
</style>

<script>

  // Shortcut for document.querySelector
  var qs = document.querySelector.bind(document)

  // Must match css media query - shrinking circle radius & pos
  if (window.innerWidth < 650)
  {
    qs('#progress').setAttribute('r', 100)
    qs('#progressbg').setAttribute('r', 100)

    qs('#progress').setAttribute('cx', 120)
    qs('#progressbg').setAttribute('cx', 120)
    
  }



  // Progress variables
  var $hours = qs('#hours .digit')
  var $minutes = qs('#minutes .digit')
  var $seconds = qs('#seconds .digit')


  /* Clock
  **********************************/
  // if you change this, also change
  // #progress animation-duration to the
  // equivalent number of seconds
  var timeInMinutes = 10; 
  var deadline = new Date(Date.parse(new Date()) + timeInMinutes*60*1000);

  qs('#progress').style.animationDuration = timeInMinutes * 60

  // UPDATED
  var fullTime = getTimeRemaining(deadline).total;

  function getTimeRemaining(endtime)
  {
    var t = Date.parse(endtime) - Date.parse(new Date());
    var seconds = Math.floor( (t/1000) % 60 );
    var minutes = Math.floor( (t/1000/60) % 60 );
    var hours = Math.floor( (t/(1000*60*60)) % 24 );
    var days = Math.floor( t/(1000*60*60*24) );
    
    
    if (minutes == 1 && !qs('#progress').style.animationName)
    {
      qs('#progress').style.animationName = 'colorfade'
    }
    return {
      'total': t,
      'days': days,
      'hours': hours,
      'minutes': minutes,
      'seconds': seconds
    };
  }

  function initializeClock(endtime)
  { 
    var timeinterval = setInterval(function() {
      var t = getTimeRemaining(endtime);
      var seconds = ('0' + t.seconds).slice(-2);
      
      // progress bar remaining UPDATED
      var pbr =  (t.total / fullTime) * 100;
      
      
      updateSliderValue(t.hours, t.minutes, seconds, false, pbr);

      if(t.total<=0)
      {      
        clearInterval(timeinterval);
        document.querySelector('.rto-container').style.display = 'none'
        document.querySelector('.rto-gradient').style.display = 'none'
        document.querySelector('.rto-wrap').style.display = 'none'
      }
    },1000);
  }




  /* Progress bar
  **************************************/

  /*
  * Updates progress bar and value
  * @param {str} hours - hours left
  * @param {str} minutes - minutes left
  * @param {str} seconds - seconds left
  * @param {bool} showHours - show/hide hours left
  * @param {int} barValue - number of total seconds left. 
  */
  function updateSliderValue(hours, mins, secs, showHours, barValue) 
  { 
    
    if (showHours)
    {
      qs('#hours').style.display = 'table-cell'
      qs('.colon').style.display = 'table-cell'    
    }
    
    $hours.innerHTML = hours
    $minutes.innerHTML = mins
    $seconds.innerHTML = secs
    var radius = qs('#progress').getAttribute('r');
    var circumference = 2 * Math.PI * radius;
    
    // Controls the loading circle %
    
    var progress_in_pixels = -(circumference * (100-barValue) / 100);
    qs('#progress').style.strokeDashoffset = progress_in_pixels+'px';
    
    
    
  /*
    if(qs('#slider').value < 25){
      qs('#progress').style.stroke = 'red';
      qs('#slidervalue').style.color = 'red';
    }
    else if(yb.id('slider').value >= 75){
      qs('#progress').style.stroke = '#7df';
      qs('#slidervalue').style.color = '#7df';
    }
    else{
      qs('#progress').style.stroke = 'gold';
      qs('#slidervalue').style.color = 'gold';
    }
    */
    
  }



  /* Initialize everything
  **************************************/
  initializeClock(deadline);


</script>