Answer the question
In order to leave comments, you need to log in
How to make an element fade out on click?
Roughly speaking, there is a certain block, partially hidden through positioning. By clicking on it, it should slide out smoothly so that all of its hidden part becomes visible. And on a second click, leave again)
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="main.css"/>
<script src="jquery.js"></script>
<script>
$(function(){
$('#popup').click(function(){
$('#popup').animate({
'bottom':'0'
},3000);
});
});
</script>
</head>
<body>
<div id="popup">
<form>
<h3>Приветствие</h3>
<input />
<input />
<button> Отправить </button>
</form>
</div>
</body>
</html>
*{
box-sizing: border-box;
}
#popup{
padding-left: 10px;
background: yellow;
height: 500px;
width: 300px;
position: fixed;
bottom: -440px;
right: 0;
border: 1px solid black;
}
input{
margin: 15px;
margin-left: 50px;
}
Answer the question
In order to leave comments, you need to log in
Here is the working code
. You have a typo:
but it should beclick(function(){
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question