250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- javascript
- php
- front-end
- 비전공 개발자
- 비전공자
- xcode
- effect
- 개발자
- keyframes
- SWIFT
- 백엔드
- image
- 자바스크립트
- iPhone
- react
- Animation
- MAC
- HTML
- jQuery
- button
- 풀스택
- ipad
- 애니메이션
- hover
- html5
- iOS 개발자
- 프론트엔드
- CSS
- IOS
- css3
Archives
- Today
- Total
비전공자 개발일기
Color Switch Animated Login Form 본문
728x90
SMALL
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>COLOR SWITCH ANIMATED LOGIN</title>
<link rel="stylesheet" href="style.css">
<script defer src="main.js"></script>
</head>
<body>
<div class="login">
<h2 id="txt">Login</h2>
<div class="inputBox">
<input type="text" placeholder="Username">
</div>
<div class="inputBox">
<input type="password" placeholder="Password">
</div>
<div class="inputBox">
<input type="submit" value="Login" id="btn">
</div>
<div class="group">
<a href="#">Forgot Password</a>
<a href="#">Sign up</a>
</div>
</div>
<div class="colors">
<span class="active" style="background-color: #1DD1A1;"></span>
<span style="background-color: #FF6B6B;" ></span>
<span style="background-color: #2E86DE;" ></span>
<span style="background-color: #F368E0;" ></span>
<span style="background-color: #FF9F43;" ></span>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
position: relative;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #1DD1A1;
transition: .5s;
}
.login {
padding: 50px;
background-color: #FFF;
width: 400px;
display: flex;
flex-direction: column;
gap: 20px;
box-shadow: 0 25px 50px rgba(0, 0, 0, .1);
}
.login h2 {
font-weight: 500;
border-left: 15px solid #1DD1A1;
line-height: 1em;
padding-left: 10px;
transition: .5s;
color: #333;
}
.login .inputBox input {
width: 100%;
padding: 10px 15px;
outline: none;
border: 2px solid #555;
font-size: 1em;
color: #333;
}
.login .inputBox input#btn {
border: none;
background-color: #1DD1A1;
transition: .5s;
font-size: 1.1em;
font-weight: 500;
cursor: pointer;
}
.login .group {
display: flex;
justify-content: space-between;
}
.login .group a {
color: #333;
text-decoration: none;
}
.login .group a:nth-child(2) {
font-weight: 500;
text-decoration: underline;
}
.colors {
position: absolute;
right: 0;
padding: 10px;
background-color: #FFF;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.colors span {
width: 20px;
height: 20px;
margin: 10px;
border-radius: 50%;
cursor: pointer;
}
.colors span.active {
border: 2px solid #333;
scale: 1.5;
transition: .5s;
}
let btn = document.getElementById("btn");
let txt = document.getElementById("txt");
function changeColor(color) {
document.body.style.backgroundColor = color;
btn.style.backgroundColor = color;
txt.style.borderLeftColor = color;
document.querySelectorAll("span").forEach(function(item) {
item.classList.remove("active");
})
event.target.classList.add("active");
}
let colorSpan = document.querySelectorAll(".colors span");
colorSpan.forEach(function(item) {
item.addEventListener("click", function() {
changeColor(this.style.backgroundColor);
})
})
728x90
LIST
'Javascript' 카테고리의 다른 글
2048 GAME (0) | 2022.10.11 |
---|---|
Cat Game (0) | 2022.10.10 |
OTP INPUT (0) | 2022.10.06 |
3D Image Carousel (0) | 2022.10.05 |
Toast MSG (0) | 2022.10.03 |