range.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <title></title>
  8. <style>
  9. html, body {
  10. margin: 0; padding: 0;
  11. font-family: monospace;
  12. font-weight: bold;
  13. }
  14. .flex {
  15. display: flex;
  16. justify-content: center;
  17. align-items: center;
  18. height: 100vh; width: 100%;
  19. padding: 60vh 0;
  20. }
  21. .rellax-container {
  22. height: 25vmin; width: 25vmin;
  23. position: relative;
  24. background: #ccc;
  25. margin: 0 3vmin;
  26. box-shadow: inset 0 .5rem 4rem -1rem rgba(0,0,0,.8),
  27. 0 -119px 0 #fff,
  28. 0 -120px 0 #888,
  29. 0 119px 0 #fff,
  30. 0 120px 0 #888;
  31. }
  32. .rellax {
  33. background: #123;
  34. color: #fff;
  35. position: absolute;
  36. top: 0; left: 0;
  37. height: 100%; width: 100%;
  38. display: flex;
  39. justify-content: center;
  40. align-items: center;
  41. box-shadow: 0 .5rem 2rem -1rem rgba(0,0,0,1);
  42. will-change: transform;
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. <div class="flex">
  48. <div class="rellax-container">
  49. <div class="rellax" data-rellax-speed="-5"> null </div>
  50. </div>
  51. <div class="rellax-container">
  52. <div class="rellax" data-rellax-speed="-5" data-rellax-min="0">min: 0</div>
  53. </div>
  54. <div class="rellax-container">
  55. <div class="rellax" data-rellax-speed="-5" data-rellax-min="-120" data-rellax-max="120">min: -120 | max: 120</div>
  56. </div>
  57. <div class="rellax-container">
  58. <div class="rellax" data-rellax-speed="-5" data-rellax-max="120">max: 120</div>
  59. </div>
  60. </div>
  61. <!-- Scripts -->
  62. <script src="../rellax.js"></script>
  63. <script>
  64. var rellax = new Rellax('.rellax', {center: true});
  65. </script>
  66. </body>
  67. </html>