Licitator 1.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.6 KiB

5 years ago
  1. <html><head>
  2. <style>
  3. @import url("https://fonts.googleapis.com/css?family=Roboto+Mono:300,500");
  4. html,
  5. body {
  6. width: 100%;
  7. height: 100%;
  8. }
  9. body {
  10. background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/257418/andy-holmes-698828-unsplash.jpg);
  11. background-size: cover;
  12. background-repeat: no-repeat;
  13. min-height: 100vh;
  14. min-width: 100vw;
  15. font-family: "Roboto Mono", "Liberation Mono", Consolas, monospace;
  16. color: rgba(255, 255, 255, 0.87);
  17. }
  18. .mx-auto {
  19. margin-left: auto;
  20. margin-right: auto;
  21. }
  22. .container,
  23. .container > .row,
  24. .container > .row > div {
  25. height: 100%;
  26. }
  27. #countUp {
  28. display: flex;
  29. flex-direction: column;
  30. justify-content: center;
  31. align-items: center;
  32. height: 100%;
  33. .number {
  34. font-size: 4rem;
  35. font-weight: 500;
  36. + .text {
  37. margin: 0 0 1rem;
  38. }
  39. }
  40. .text {
  41. font-weight: 300;
  42. text-align: center;
  43. }
  44. }
  45. </style>
  46. <script>
  47. var formatThousandsNoRounding = function(n, dp){
  48. var e = '', s = e+n, l = s.length, b = n < 0 ? 1 : 0,
  49. i = s.lastIndexOf(','), j = i == -1 ? l : i,
  50. r = e, d = s.substr(j+1, dp);
  51. while ( (j-=3) > b ) { r = '.' + s.substr(j, 3) + r; }
  52. return s.substr(0, j + 3) + r +
  53. (dp ? ',' + d + ( d.length < dp ?
  54. ('00000').substr(0, dp - d.length):e):e);
  55. };
  56. var hasRun = false;
  57. inView('#countUp').on('enter', function() {
  58. if (hasRun == false) {
  59. $('.number').each(function() {
  60. var $this = $(this),
  61. countTo = $this.attr('data-count');
  62. $({ countNum: $this.text()}).animate({
  63. countNum: countTo
  64. },
  65. {
  66. duration: 2000,
  67. easing:'linear',
  68. step: function() {
  69. $this.text(formatThousandsNoRounding(Math.floor(this.countNum)));
  70. },
  71. complete: function() {
  72. $this.text(formatThousandsNoRounding(this.countNum));
  73. }
  74. });
  75. });
  76. hasRun = true;
  77. }
  78. });
  79. </script>
  80. </head><body>
  81. <div class="container">
  82. <div class="row">
  83. <div class="xs-12 md-6 mx-auto">
  84. <div id="countUp">
  85. <div class="number" data-count="404">404</div>
  86. <div class="text">Page not found</div>
  87. <!---<div class="text">This may not mean anything.</div>
  88. <div class="text">I'm probably working on something that has blown up.</div>-->
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </body></html>