JSFiddle - React, Tailwind, and code Playground
by eklingen
HTML
<div id="button-top">
<img src="http://i43.tinypic.com/dcajis.png" alt="" />
<div class="slide inner">
<p>TEXT</p>
</div>
</div>
<div id="button-bottom">
<img src="http://i43.tinypic.com/dcajis.png" alt="" />
<div class="slide inner">
<p>TEXT</p>
</div>
</div>
CSS
#button-top {
width: 112px;
height: 112px;
position: absolute;
left: 73%;
top: 40px;
padding-left: 100px;
padding-right: 5px;
overflow: hidden;
z-index: 200;
}
.slide {
position: relative;
height: 100px;
overflow: hidden;
width: 350px;
}
.slide img {
position: relative;
z-index: 100;
}
.slide p {
width: 70px;
padding:12px;
color: #fff;
margin: 0;
}
.inner {
position: absolute;
right: 50px;
top: 0;
width: 0;
height: 84px;
margin: 12px;
background: #0d90cd;
overflow: hidden;
z-index: -1;
-webkit-border-radius:30px 0 0 30px;
-moz-border-radius:30px 0 0 30px;
border-radius:30px 0 0 30px;
}
#button-bottom {
width: 112px;
height: 112px;
position: absolute;
left: 73%;
top: 180px;
padding-left: 100px;
padding-right: 5px;
overflow: hidden;
z-index: 100;
}
#button-top:hover, #button-bottom:hover {
cursor: pointer;
}
JavaScript
$('#button-top,#button-bottom').toggle(function () {
$('.inner', this).animate({
width: 140
});
}, function () {
$('.inner', this).animate({
width: 0
});
});