Answer the question
In order to leave comments, you need to log in
How to implement such block switching in pure JS?
Tell me how to do the same switching of registration blocks on a javascript cheat https://codepen.io/AlexisBertin/pen/qOMegE here it's done through angular
it's interesting to understand how it can work on pure js
Answer the question
In order to leave comments, you need to log in
document.querySelector('.buy').addEventListener('click', (e)=>{
if(e.target){
document.querySelector('.login-content-signin').style.opacity="0"
document.querySelector('.login-content-signin').style.zIndex="-1"
document.querySelector('.login-content-signup').style.opacity="1"
document.querySelector('.login-content-signup').style.zIndex="1"
}
})
document.querySelector('.hi').addEventListener('click', (e)=>{
if(e.target){
document.querySelector('.login-content-signin').style.opacity="1"
document.querySelector('.login-content-signin').style.zIndex="1"
document.querySelector('.login-content-signup').style.opacity="0"
document.querySelector('.login-content-signup').style.zIndex="-1"
}
})
<button ng-click="showSignIn=false" class="hi">Login</button>
<button ng-click="showSignIn=true" class="buy">Sign Up</button>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question