diff --git a/my code/08-form-wave/index.html b/my code/08-form-wave/index.html new file mode 100644 index 0000000..0bd4fe8 --- /dev/null +++ b/my code/08-form-wave/index.html @@ -0,0 +1,33 @@ + + + + + + + + 08 form wave + + + + + + +
+

Please Login

+
+
+ +
+
+ +
+ + +
+ Don't have an account? Register here +
+ + + + + \ No newline at end of file diff --git a/my code/08-form-wave/script.js b/my code/08-form-wave/script.js new file mode 100644 index 0000000..c011d67 --- /dev/null +++ b/my code/08-form-wave/script.js @@ -0,0 +1,26 @@ +const labels = document.querySelectorAll("label"); +const email = document.getElementById("email"); +const password = document.getElementById("password"); + +labels.forEach((label) => { + label.innerHTML = label.innerText + .split("") + .map( + (letter, idx) => + `${letter}` + ) + .join(""); +}); + +window.addEventListener("click", () => { + if (email == document.activeElement) { + labels[0].classList.add("active"); + labels[1].classList.remove("active"); + } else if (password == document.activeElement) { + labels[1].classList.add("active"); + labels[0].classList.remove("active"); + } else { + labels[0].classList.remove("active"); + labels[1].classList.remove("active"); + } +}); diff --git a/my code/08-form-wave/style.css b/my code/08-form-wave/style.css new file mode 100644 index 0000000..0c923e3 --- /dev/null +++ b/my code/08-form-wave/style.css @@ -0,0 +1,71 @@ +* { + margin: 0; + padding: 0; +} + +body { + height: 100vh; + width: 100vw; + display: flex; + justify-content: center; + align-items: center; + background-color: steelblue; +} + +.container { + padding: 50px; + background-color: rgba(0, 0, 0, 0.4); + border-radius: 10px; + display: flex; + flex-direction: column; + justify-self: center; + align-items: center; +} + +.container, +label, +input { + font-family: sans-serif; + color: #ffffff; + font-size: 20px; +} + +form { + width: 100%; +} + +.form-input { + position: relative; + margin-top: 20px; + margin-bottom: 40px; +} + +label { + position: absolute; + bottom: 20px; + transition: all 0.15s cubic-bezier(0.68, -0.55, 0.265, 1.55); +} + +label.active { + transform: translateY(-40px); +} + +input { + background-color: unset; + border: unset; + outline: none; + border-bottom: 2px solid #ffffff; + width: 100%; + padding: 20px 0; + display: block; +} + +input[type="submit"] { + background-color: rgba(255, 255, 255, 0.8); + color: steelblue; + border-radius: 10px; + padding: 15px; + border-bottom: unset; + margin-bottom: 20px; + cursor: pointer; +}