responsive-speeds.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8" />
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <title>Responsive Speeds</title>
  7. <style>
  8. html,
  9. body {
  10. color: #223;
  11. font-size: 21pt;
  12. margin: 0;
  13. padding: 0;
  14. }
  15. section {
  16. margin-top: 30vh;
  17. width: 100vw;
  18. height: 200vh;
  19. -webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
  20. -webkit-flex: 1; /* Safari 6.1+. iOS 7.1+, BB10 */
  21. -ms-flex: 1; /* IE 10 */
  22. flex: 1; /* NEW, Spec - Firefox, Chrome */
  23. }
  24. h4 {
  25. text-align: center;
  26. }
  27. .block {
  28. background: #223;
  29. position: relative;
  30. padding-top: 45px;
  31. width: 100%;
  32. }
  33. .block::before {
  34. content: "Static BG - Mobile";
  35. color: #fff;
  36. position: absolute;
  37. margin-left: 15px;
  38. top: 0;
  39. }
  40. @media screen and (min-width: 768px) {
  41. .block::before {
  42. content: "Static BG - Tablet";
  43. }
  44. }
  45. @media screen and (min-width: 1201px) {
  46. .block::before {
  47. content: "Static BG - Desktop";
  48. }
  49. }
  50. span {
  51. background: #eed;
  52. color: #223;
  53. text-align: left;
  54. padding: 10px;
  55. display: block;
  56. width: 50%;
  57. margin-left: 25%;
  58. min-height: 100px;
  59. box-sizing: border-box;
  60. border: 1px solid #ccc;
  61. }
  62. </style>
  63. </head>
  64. <body>
  65. <section>
  66. <div class="block">
  67. <span
  68. class="rellax"
  69. data-rellax-speed="-2"
  70. data-rellax-xs-speed="1"
  71. data-rellax-mobile-speed="3"
  72. data-rellax-tablet-speed="7"
  73. data-rellax-desktop-speed="10"
  74. >I move upwards faster on larger screens</span
  75. >
  76. <span
  77. class="rellax"
  78. data-rellax-speed="-2"
  79. data-rellax-xs-speed="-1"
  80. data-rellax-mobile-speed="-3"
  81. data-rellax-tablet-speed="-7"
  82. data-rellax-desktop-speed="-10"
  83. >I move downwards faster on larger screens</span
  84. >
  85. </div>
  86. </section>
  87. <!-- Scripts -->
  88. <script src="../rellax.js"></script>
  89. <script>
  90. var rellax = new Rellax(".rellax", {
  91. breakpoints: [200, 400, 600]
  92. });
  93. </script>
  94. </body>
  95. </html>