<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CodePen - Sliding Sign In & Sign Up Form with Vue JS</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<div id="app">
<article>
<div class="container" :class="{'sign-up-active' : signUp}">
<div class="overlay-container">
<div class="overlay">
<div class="overlay-left">
<h2>Welcome Back!</h2>
<p>Please login with your personal info</p>
<button class="invert" id="signIn" @click="signUp = !signUp">Sign In</button>
</div>
<div class="overlay-right">
<h2>Hello, Friend!</h2>
<p>Please enter your personal details</p>
<button class="invert" id="signUp" @click="signUp = !signUp">Sign Up</button>
</div>
</div>
</div>
<form class="sign-up" action="#">
<h2>Create login</h2>
<div>Use your email for registration</div>
<input type="text" placeholder="Name" />
<input type="email" placeholder="Email" />
<input type="password" placeholder="Password" />
<button>Sign Up</button>
</form>
<form class="sign-in" action="#">
<h2>Sign In</h2>
<div>Use your account</div>
<input type="email" placeholder="Email" />
<input type="password" placeholder="Password" />
<a href="#">Forgot your password?</a>
<button>Sign In</button>
</form>
</div>
</article>
<!-- Youtube Link -->
<a id="yt_link" target="_blank" href="https://www.youtube.com/watch?v=uotY_cx1dvo&list=PLINmvGGUwYc2FVxImTwT66Phi4hQ2embf">Watch on YouTube</a>
</div>
<!-- partial -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js'></script><script src="./script.js"></script>
</body>
</html>
body {
margin: 0;
padding: 0;
width: 100%;
height: 100vh;
overflow: hidden;
}
#app {
font-family: Tahoma;
font-size: 1rem;
color: #222;
background-color: #092525;
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container {
position: relative;
width: 768px;
height: 480px;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2), 0 10px 10px rgba(0, 0, 0, 0.2);
background: linear-gradient(to bottom, #efefef, #ccc);
}
.container .overlay-container {
position: absolute;
top: 0;
left: 50%;
width: 50%;
height: 100%;
overflow: hidden;
transition: transform .5s ease-in-out;
z-index: 100;
}
.container .overlay {
position: relative;
left: -100%;
height: 100%;
width: 200%;
background: linear-gradient(to bottom right, #7FD625, #009345);
color: #fff;
transform: translateX(0);
transition: transform .5s ease-in-out;
}
.container .overlay-left {
position: absolute;
top: 0;
display: flex;
align-items: center;
justify-content: space-around;
flex-direction: column;
padding: 70px 40px;
width: calc(50% - 80px);
height: calc(100% - 140px);
text-align: center;
transform: translateX(-20%);
transition: transform .5s ease-in-out;
}
.container .overlay-right {
position: absolute;
top: 0;
display: flex;
align-items: center;
justify-content: space-around;
flex-direction: column;
padding: 70px 40px;
width: calc(50% - 80px);
height: calc(100% - 140px);
text-align: center;
transform: translateX(0);
transition: transform .5s ease-in-out;
right: 0;
}
h2 {
margin: 0;
}
p {
margin: 20px 0 30px;
}
a {
color: #222;
text-decoration: none;
margin: 15px 0;
font-size: 1rem;
}
button {
border-radius: 20px;
border: 1px solid #009345;
background-color: #009345;
color: #fff;
font-size: 1rem;
font-weight: bold;
padding: 10px 40px;
letter-spacing: 1px;
text-transform: uppercase;
cursor: pointer;
transition: transform .1s ease-in;
}
button:active {
transform: scale(0.9);
}
button:focus {
outline: none;
}
button.invert {
background-color: transparent;
border-color: #fff;
}
form {
position: absolute;
top: 0;
display: flex;
align-items: center;
justify-content: space-around;
flex-direction: column;
padding: 90px 60px;
width: calc(50% - 120px);
height: calc(100% - 180px);
text-align: center;
background: linear-gradient(to bottom, #efefef, #ccc);
transition: all .5s ease-in-out;
}
form div {
font-size: 1rem;
}
form input {
background-color: #eee;
border: none;
padding: 8px 15px;
margin: 6px 0;
width: calc(100% - 30px);
border-radius: 15px;
border-bottom: 1px solid #ddd;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4), 0 -1px 1px #fff, 0 1px 0 #fff;
overflow: hidden;
}
form input:focus {
outline: none;
background-color: #fff;
}
.sign-in {
left: 0;
z-index: 2;
}
.sign-up {
left: 0;
z-index: 1;
opacity: 0;
}
.sign-up-active .sign-in {
transform: translateX(100%);
}
.sign-up-active .sign-up {
transform: translateX(100%);
opacity: 1;
z-index: 5;
animation: show .5s;
}
.sign-up-active .overlay-container {
transform: translateX(-100%);
}
.sign-up-active .overlay {
transform: translateX(50%);
}
.sign-up-active .overlay-left {
transform: translateX(0);
}
.sign-up-active .overlay-right {
transform: translateX(20%);
}
@keyframes show {
0% {
opacity: 0;
z-index: 1;
}
49% {
opacity: 0;
z-index: 1;
}
50% {
opacity: 1;
z-index: 10;
}
}
/* Youtube Link */
#yt_link {
position: absolute;
right: 0;
left: 0;
bottom: -200px;
display: block;
width: 160px;
text-align: center;
color: red;
font-size: 15px;
text-decoration: none;
font-family: Verdana, Geneva, Tahoma, sans-serif;
padding: 10px;
margin: 0 auto;
background-color: #fff;
border-radius: 2px;
animation: showYtLink 1.5s ease 3s forwards;
}
@keyframes showYtLink {
0% {
bottom: -200px;
}
100% {
bottom: 20px;
}
}
new Vue({
el: '#app',
data: () => {
return {
signUp: false
}
}
})