Pop up form on button click JavaScript

Pop up form on button click JavaScript

Pop up form on button click JavaScript


code to show Pop up form on button click JavaScript

 <!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title></title>

<style type="text/css">

.login-container

{

background: rgba(5,4,4,0.8);

position: absolute;

top: 10px;

right: 100px;

opacity: 0;

transform: translateX(100px);

transition: 0.5s opacity,0.5s transform;


}

.boxtoshow

{

color:white;

padding: 10px;

}

.boxtoshow form div

{

padding: 5px;

}


.show-and-hide

{

transform: translateX(0px);

opacity:1;

}

.close-button

{

background: red;

color:white;

position:absolute;

right:0;

cursor:pointer;

}

#logbtn

{

background:rgba(5,4,3,0.6);

color:white;

border:2px solid white;

padding:5px;


}

</style>

</head>

<body>

<header>

<div>

<button onclick="showbox();">login</button>

</div>


<div class="login-container" id="loginbox">

<button onclick="showbox();" class="close-button">X</button>

<div class="boxtoshow">

<form>

<center><h2>login</h2></center>

<div><label>email</label></div>

<div><input type="email"></div>



<div><label>password</label></div>

<div><input type="password"></div>


<div><input type="submit" value="login" id="logbtn"></div>


</form>

</div>


</div>


<h1>this is datathis is datathis is datathis is datathis is datathis is datathis is datathis is datathis is datathis is datathis is datathis is data</h1>


</header>

<script>


function showbox()

{

var a =document.getElementById('loginbox');

a.classList.toggle("show-and-hide");

}


</script>

</body>

</html>

0 Comments