JSFiddle - React, Tailwind, and code Playground
HTML
<div id="slideout">
<div id="slidecontent">
Yar, there be dragonns herre!
</div>
<div id="clickme">
</div>
</div>
<div id="slideout2">
<div id="slidecontent2">
Yar, there be dragonns herre!
</div>
<div id="clickme2">
</div>
</div>
CSS
body {
overflow: hidden;
}
#slideout {
background: #666;
position: absolute;
width: 280px;
height: 80px;
top: 45%;
right:-280px;
padding-left: 20px
}
#clickme {
position: absolute;
top: 0; left: 0;
height: 20px;
width: 20px;
background: #ff0000;
}
#slidecontent {
float:left;
}
#slideout2 {
background: #666;
position: absolute;
width: 280px;
height: 100px;
top: auto;
bottom:-50px;
left:100px;
padding-left: 20px
}
#clickme2 {
position: absolute;
top: 0; left: 0;
height: 20px;
width: 20px;
background: #ff0000;
}
#slidecontent2 {
float:left;
}
JavaScript
$(function () {
$("#clickme").toggle(function () {
$(this).parent().animate({right:'0px'}, {queue: false, duration: 500});
}, function () {
$(this).parent().animate({right:'-280px'}, {queue: false, duration: 500});
});
$("#clickme2").toggle(function () {
$(this).parent().animate({bottom:'0px'}, {queue: false, duration: 500});
}, function () {
$(this).parent().animate({bottom:'-50px'}, {queue: false, duration: 500});
});
});