JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div id="image"></div>
<div id="my_form">
<div class="sign_in modal">
<h1>Get Started!</h1>
<form action="" method="get">
<input type="text" name="fname" placeholder="Name" required>
<input type="text" name="email" placeholder="Email" required>
<input type="password" name="password" placeholder="Password" required>
<input type="submit" value="Submit" class="submit">
</form>
<h3><a href="#" id="switchLogin">Been Here Before?</a></h3>
</div>
<div class="log_in modal">
<h1>Welcome Back!</h1>
<form action="" method="get">
<input type="text" name="uname" placeholder="User Name" required>
<input type="password" name="password" placeholder="Password" required>
<input type="submit" value="Submit" class="submit">
</form>
<h3><a href="#" id="switchSignin">First Time?</a></h3>
</div>
</div>
</div>
CSS
.slideOut{
-webkit-animation: slideOut 1s linear;
-moz-animation: slideOut 1s linear;
-o-animation: slideOut 1s linear;
animation: slideOut 1s linear;
}
@-webkit-keyframes slideOut {
0% { opacity: 1; display:block;}
100% { opacity: 0; transform: translateX(-1000px);}
}
@-moz-keyframes slideOut {
0% { opacity: 1; display:block;}
100% { opacity: 0; transform: translateX(-1000px);}
}
@-o-keyframes slideOut {
0% { opacity: 1; display:block;}
100% { opacity: 0; transform: translateX(-1000px);}
}
@keyframes slideOut {
0% { opacity: 1; display:block;}
100% { opacity: 0; transform: translateX(-1000px);}
}
JavaScript
var body = document.getElementsByTagName('body'),
signIn = document.getElementsByClassName('sign_in modal'),
logIn = document.getElementsByClassName('log_in'),
switchLogIn = document.getElementById('switchLogin'),
switchSignIn = document.getElementById('switchSignin'),
link = document.querySelector('a');
link.addEventListener("click", function(e){
if ((e.target || e.srcElement).id == 'switchLogin'){
console.log(signIn);
console.log(signIn[0].classList);
link.style.color="red";
}else{
console.log("nope");
}
})