JSFiddle - React, Tailwind, and code Playground
HTML
<div class="pollSlider"></div>
<div id="pollSlider-button"></div>
CSS
.pollSlider{
position:fixed;
height:100%;
background:red;
width:200px;
right:0px;
margin-right: -200px;
}
#pollSlider-button{
position:fixed;
width:100px;
height:50px;
right:0px;
background:green;
top:300px;
}
JavaScript
$(document).ready(function()
{
$('#pollSlider-button').click(function() {
if($(this).css("margin-right") == "200px")
{
$('.pollSlider').animate({"margin-right": '-=200'});
$('#pollSlider-button').animate({"margin-right": '-=200'});
}
else
{
$('.pollSlider').animate({"margin-right": '+=200'});
$('#pollSlider-button').animate({"margin-right": '+=200'});
}
});
});