-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
175 lines (167 loc) · 6.89 KB
/
index.html
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Cairo:400,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.2/css/all.css"
integrity="sha256-piqEf7Ap7CMps8krDQsSOTZgF+MU/0MPyPW2enj5I40=" crossorigin="anonymous" />
<title>Sign Up Modal</title>
</head>
<body>
<div class="modal-wrapper">
<div class="login-wrapper">
<div class="collapsed-section hidden">
<div class="hide-section">
<h2 class="collapsed-heading">Have an Account?</h2>
<p class="collapsed-text">To keep connected with us please<br>login with your personal info</p>
<button class="collapsed-btn" onclick="toggleOpen()">Log In</button>
</div>
</div>
<div class="form-wrapper login">
<h2 class="form-heading">Log In To Your Profile</h2>
<div class="other-icons">
<a href="#">
<i class="fab fa-facebook-f"></i>
</a>
<a href="#">
<i class="fab fa-google"></i>
</a>
<a href="#">
<i class="fab fa-twitter"></i>
</a>
</div>
<form action="" class="form login">
<span>or use your email account:</span>
<div class="input-field">
<i class="fas fa-envelope"></i>
<input type="email" placeholder="Email" value="">
</div>
<div class="input-field">
<i class="fas fa-key"></i>
<input type="password" placeholder="Password" value="">
</div>
<a href="#" id="forgot-password">Forgot Your Password?</a>
<button class="form-btn" type="submit">Log In</button>
</form>
</div>
</div>
<div class="signup-wrapper">
<div class="collapsed-section">
<div class="hide-section">
<h2 class="collapsed-heading">New Here?</h2>
<p class="collapsed-text">Enter your personal details<br>and start journey with us!</p>
<button class="collapsed-btn" onclick="toggleOpen()">Sign Up</button>
</div>
</div>
<div class="form-wrapper signup hidden">
<h2 class="form-heading">Create Account</h2>
<div class="other-icons">
<a href="#">
<i class="fab fa-facebook-f"></i>
</a>
<a href="#">
<i class="fab fa-google"></i>
</a>
<a href="#">
<i class="fab fa-twitter"></i>
</a>
</div>
<form action="" class="form login">
<span>or use your email for registration:</span>
<div class="input-field">
<i class="fas fa-user"></i>
<input type="text" placeholder="Name" value="">
</div>
<div class="input-field">
<i class="fas fa-envelope"></i>
<input type="email" placeholder="Email" value="">
</div>
<div class="input-field">
<i class="fas fa-key"></i>
<input type="password" placeholder="Password" value="">
</div>
<button class="form-btn" type="submit">Sign Up</button>
</form>
</div>
</div>
</div>
<script>
//DIVS to toggle
var loginForm = document.querySelector(".login-wrapper").querySelector(".form-wrapper");
var loginCollapsed = document.querySelector(".login-wrapper").querySelector(".collapsed-section");
var signupForm = document.querySelector(".signup-wrapper").querySelector(".form-wrapper");
var signupCollapsed = document.querySelector(".signup-wrapper").querySelector(".collapsed-section");
var loginHide = loginCollapsed.querySelector(".hide-section");
var signupHide = signupCollapsed.querySelector(".hide-section");
var loginOpen = true;
var animationDuration = 1000;
function toggleOpen() {
loginOpen = !loginOpen;
//Animation
if (window.matchMedia("(max-width: 799px)").matches) {
//MOBILE
if (!loginOpen) {
signupCollapsed.style.animation = `moveCollapsedUp ${animationDuration}ms ease-in-out 0s`;
signupHide.style.animation = `fade ${animationDuration}ms ease-in-out 0s`;
loginForm.style.animation = `moveFormDown ${animationDuration}ms ease-in-out 0s, fade ${animationDuration}ms ease-in-out 0s`;
}
else {
loginCollapsed.style.animation = `moveCollapsedDown ${animationDuration}ms ease-in-out 0s`;
loginHide.style.animation = `fade ${animationDuration}ms ease-in-out 0s`;
signupForm.style.animation = `moveFormUp ${animationDuration}ms ease-in-out 0s, fade ${animationDuration}ms ease-in-out 0s`;
}
}
else {
//DESKTOP
if (!loginOpen) {
signupCollapsed.style.animation = `moveLeft ${animationDuration}ms ease-in-out 0s`;
signupHide.style.animation = `fade ${animationDuration}ms ease-in-out 0s`;
loginForm.style.animation = `moveRight ${animationDuration}ms ease-in-out 0s, fade ${animationDuration}ms ease-in-out 0s`;
}
else {
loginCollapsed.style.animation = `moveRight ${animationDuration}ms ease-in-out 0s`;
loginHide.style.animation = `fade ${animationDuration}ms ease-in-out 0s`;
signupForm.style.animation = `moveLeft ${animationDuration}ms ease-in-out 0s, fade ${animationDuration}ms ease-in-out 0s`;
}
}
setTimeout(makeChanges, animationDuration);
}
function makeChanges() {
//CHANGE VISIBILITY OF ALL ELEMENTS
loginForm.classList.toggle("hidden");
loginCollapsed.classList.toggle("hidden");
signupForm.classList.toggle("hidden");
signupCollapsed.classList.toggle("hidden");
changeOrientation();
//Remove Aniamtions
signupCollapsed.style.animation = "none";
signupForm.style.animation = "none";
signupHide.style.animation = "none";
loginCollapsed.style.animation = "none";
loginHide.style.animation = "none";
loginForm.style.animation = "none";
}
function changeOrientation() {
if (window.matchMedia("(max-width: 799px)").matches) {
if (loginOpen) {
document.querySelector(".login-wrapper").style.height = "70%";
document.querySelector(".signup-wrapper").style.height = "30%";
}
else {
document.querySelector(".login-wrapper").style.height = "30%";
document.querySelector(".signup-wrapper").style.height = "70%";
}
}
else {
document.querySelector(".login-wrapper").style.height = "100%";
document.querySelector(".signup-wrapper").style.height = "100%";
}
}
window.addEventListener("resize", changeOrientation);
changeOrientation();
</script>
</body>
</html>