JSFiddle - React, Tailwind, and code Playground
by jojaba
HTML
<article>
<h1>Test slideUp - slideDown</h1>
<p>Ceci est la section "article"</p>
<p>Merci pour votre aide ! </p>
</article>
<aside>
<header>
<h3><span id="contact-toggle" title="Toggle the contact form">Nous contacter</span></h3>
</header>
<div class="cont">
<div id="contact">
<h4>Le formulaire de contact</h4>
<p>Je l'agrandi pour voir...</p>
<p>Je l'agrandi pour voir...</p>
<p>Je l'agrandi pour voir...</p>
<p>Je l'agrandi pour voir...</p>
<p>Je l'agrandi pour voir...</p>
</div>
</div>
</aside>
<footer>Le footer</footer>
CSS
.cont {
position: relative;
height: 240px;
}
aside h3 {
margin: 0;
padding: 0 5%;
color: #FFF;
font-size: 1.5em;
}
aside h3 span#contact-toggle {
color: rgb(89, 20, 44);
padding: 2px 1%;
border-left: rgb(89, 20, 44) solid 5px;
}
#contact {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
background: rgb(211, 211, 211);
}
footer {
background: #000;
color: #FFF;
}
JavaScript
$(document).ready(function(){
/* *********************************** */
/* Contact form toggle */
/* ********************************** */
$("#contact-toggle").on("click", function() {
if ($(".cont").css("height") != "0px") {
$("#contact").slideUp(500, function() {
$(".cont").css("height", 0);
});
}
else {
$(".cont").css("height", "240px");
$("#contact").slideDown(500);
}
});
});