|
| 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 | + <title>Day 62/100</title> |
| 7 | + </head> |
| 8 | + <body> |
| 9 | + <main> |
| 10 | + <div class="cards show-card-1" id="cards"> |
| 11 | + <div class="card card-1" id="card-1"> |
| 12 | + <div class="title">Card 1</div> |
| 13 | + </div> |
| 14 | + <div class="card card-2" id="card-2"> |
| 15 | + <div class="title">Card 2</div> |
| 16 | + </div> |
| 17 | + <div class="card card-3" id="card-3"> |
| 18 | + <div class="title">Card 3</div> |
| 19 | + </div> |
| 20 | + </div> |
| 21 | + </main> |
| 22 | + |
| 23 | + <style> |
| 24 | + @font-face { |
| 25 | + font-family: "SpaceMono"; |
| 26 | + src: url("/assets/SpaceMono-Bold.woff2") format("woff2"); |
| 27 | + font-weight: 700; |
| 28 | + } |
| 29 | + |
| 30 | + body { |
| 31 | + margin: 0; |
| 32 | + overflow: hidden; |
| 33 | + display: flex; |
| 34 | + flex-direction: column; |
| 35 | + justify-content: flex-end; |
| 36 | + align-items: center; |
| 37 | + -webkit-tap-highlight-color: transparent; |
| 38 | + width: 100vw; |
| 39 | + height: 100vh; |
| 40 | + background-color: #fff; |
| 41 | + } |
| 42 | + |
| 43 | + .cards { |
| 44 | + position: relative; |
| 45 | + display: flex; |
| 46 | + flex-direction: column; |
| 47 | + height: 95vh; |
| 48 | + width: 100vw; |
| 49 | + max-width: 600px; |
| 50 | + } |
| 51 | + |
| 52 | + .card { |
| 53 | + position: absolute; |
| 54 | + cursor: pointer; |
| 55 | + top: calc(100% - 100px); |
| 56 | + left: 0; |
| 57 | + width: calc(100% - 6px); |
| 58 | + height: 100px; |
| 59 | + background-color: #fff; |
| 60 | + border-radius: 15px 15px 0 0; |
| 61 | + border-top: 3px solid #000; |
| 62 | + border-left: 3px solid #000; |
| 63 | + border-right: 3px solid #000; |
| 64 | + transition: top 0.5s ease-in-out, height 0.5s ease-in-out, |
| 65 | + background-color 0.25s ease-in-out; |
| 66 | + } |
| 67 | + |
| 68 | + .card:hover { |
| 69 | + background-color: rgba(235, 235, 235, 1); |
| 70 | + } |
| 71 | + |
| 72 | + .show-card-1 .card-1 { |
| 73 | + top: 0; |
| 74 | + height: 100%; |
| 75 | + } |
| 76 | + |
| 77 | + .show-card-1 .card-2 { |
| 78 | + top: calc(100% - 150px); |
| 79 | + height: 100%; |
| 80 | + } |
| 81 | + |
| 82 | + .show-card-2 .card-1, |
| 83 | + .show-card-3 .card-1 { |
| 84 | + top: 0; |
| 85 | + height: 100%; |
| 86 | + } |
| 87 | + |
| 88 | + .show-card-2 .card-2, |
| 89 | + .show-card-3 .card-2 { |
| 90 | + top: 50px; |
| 91 | + height: calc(100% - 50px); |
| 92 | + } |
| 93 | + |
| 94 | + .show-card-3 .card-3 { |
| 95 | + top: 100px; |
| 96 | + height: calc(100% - 100px); |
| 97 | + } |
| 98 | + |
| 99 | + .title { |
| 100 | + position: absolute; |
| 101 | + top: 0; |
| 102 | + left: 0; |
| 103 | + height: 100%; |
| 104 | + font-family: "SpaceMono", monospace; |
| 105 | + font-weight: 700; |
| 106 | + font-size: 20px; |
| 107 | + height: 45px; |
| 108 | + display: flex; |
| 109 | + align-items: center; |
| 110 | + padding-left: 15px; |
| 111 | + padding-right: 15px; |
| 112 | + color: #000; |
| 113 | + transition: all 0.5s ease-in-out; |
| 114 | + } |
| 115 | + |
| 116 | + .show-card-1 .card-1 .title, |
| 117 | + .show-card-2 .card-2 .title, |
| 118 | + .show-card-3 .card-3 .title { |
| 119 | + height: 50px; |
| 120 | + font-size: 25px; |
| 121 | + } |
| 122 | + </style> |
| 123 | + |
| 124 | + <script> |
| 125 | + const cards = document.getElementById("cards"); |
| 126 | + const card1 = document.getElementById("card-1"); |
| 127 | + const card2 = document.getElementById("card-2"); |
| 128 | + const card3 = document.getElementById("card-3"); |
| 129 | + |
| 130 | + card1.addEventListener("click", () => { |
| 131 | + cards.classList = "cards show-card-1"; |
| 132 | + }); |
| 133 | + card2.addEventListener("click", () => { |
| 134 | + cards.classList = "cards show-card-2"; |
| 135 | + }); |
| 136 | + card3.addEventListener("click", () => { |
| 137 | + cards.classList = "cards show-card-3"; |
| 138 | + }); |
| 139 | + </script> |
| 140 | + </body> |
| 141 | +</html> |
0 commit comments