index.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta
  6. name="viewport"
  7. content="width=device-width, initial-scale=1, user-scalable=no"
  8. />
  9. <title>Hero animation</title>
  10. <script type="module" src="./index.js"></script>
  11. <style>
  12. {
  13. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  14. }
  15. html,
  16. body {
  17. height: 100%;
  18. margin: 0;
  19. }
  20. body {
  21. background: #fff;
  22. font-family: sans-serif;
  23. }
  24. .page-container {
  25. width: 100%;
  26. position: relative;
  27. background: #fff;
  28. }
  29. @media (min-width: 28em), @media (min-height: 38em) {
  30. body {
  31. display: flex;
  32. flex-direction: column;
  33. align-items: center;
  34. justify-content: center;
  35. background: #aaaaaa;
  36. position: relative;
  37. }
  38. .page-container {
  39. box-shadow: 0 0 1em rgba(0, 0, 0, 0.5);
  40. width: 28em;
  41. min-height: 38em;
  42. height: 38em;
  43. }
  44. }
  45. .page {
  46. background: #fff;
  47. transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
  48. width: 100%;
  49. height: 100%;
  50. }
  51. h2 {
  52. font-size: 1.1em;
  53. margin: 0.2em 0;
  54. }
  55. .header {
  56. height: 3.5em;
  57. background: #1293ea;
  58. overflow: hidden;
  59. }
  60. .header-content {
  61. width: 100%;
  62. box-sizing: border-box;
  63. padding: 0.4em 0.8em;
  64. color: #fff;
  65. display: flex;
  66. align-items: center;
  67. position: absolute;
  68. transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
  69. }
  70. .header h1 {
  71. font-weight: normal;
  72. margin: 0;
  73. font-size: 1.5em;
  74. line-height: 1.8em;
  75. }
  76. .header-title {
  77. color: #fff;
  78. font-size: 1.5em;
  79. line-height: 1.8em;
  80. transition: transform 0.4s ease-in-out;
  81. overflow: hidden;
  82. text-overflow: ellipsis;
  83. white-space: nowrap;
  84. }
  85. .header .rank {
  86. display: flex;
  87. flex-direction: column;
  88. align-items: center;
  89. justify-content: center;
  90. width: 2.7em;
  91. height: 2.7em;
  92. margin-right: 0.5em;
  93. position: relative;
  94. }
  95. .header .rank-circle {
  96. position: absolute;
  97. background: #fff;
  98. width: 2.7em;
  99. height: 2.7em;
  100. border-radius: 1.35em;
  101. margin-right: 0.5em;
  102. transition: transform 0.4s ease-in-out;
  103. top: 0;
  104. left: 0;
  105. }
  106. .header-rank {
  107. z-index: 2;
  108. color: #1293ea;
  109. font-size: 1.5em;
  110. }
  111. .header .close {
  112. line-height: 1.8em;
  113. cursor: pointer;
  114. text-align: center;
  115. width: 1.8em;
  116. height: 1.8em;
  117. border-radius: 0.9em;
  118. background: rgba(0, 0, 0, 0.5);
  119. transition: transform 0.4s ease-in-out;
  120. }
  121. .hero {
  122. transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
  123. }
  124. .page-content {
  125. position: relative;
  126. overflow: hidden;
  127. width: 100%;
  128. height: calc(100% - 3.5em);
  129. }
  130. .list {
  131. position: absolute;
  132. width: 100%;
  133. transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
  134. }
  135. .desc {
  136. position: absolute;
  137. transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
  138. padding: 1em;
  139. }
  140. .spacer {
  141. flex: 1;
  142. }
  143. .row {
  144. cursor: pointer;
  145. box-sizing: border-box;
  146. padding: 1em;
  147. }
  148. .row:not(:first-child) {
  149. border-top: 1px solid #eeeeee;
  150. }
  151. .row div {
  152. display: inline-block;
  153. }
  154. .row > div:nth-child(1) {
  155. text-align: center;
  156. margin-right: 1em;
  157. width: 1em;
  158. }
  159. </style>
  160. </head>
  161. <body>
  162. <div id="container"></div>
  163. </body>
  164. </html>