JSFiddle - React, Tailwind, and code Playground
by jestho
HTML
<button class="share m-share-square">
<i class="fa fa-heart"></i>
<a href="#facebook"><i class="fa fa-facebook"></i></a>
<a href="#twitter"><i class="fa fa-twitter"></i></a>
<a href="#pinterest"><i class="fa fa-pinterest"></i></a>
</button>
SCSS
@import url('//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css');
$share-square-size: 40px;
.share-square-common {
background: #111;
border-radius: 100%;
color: #fff;
display: inline-block;
line-height: $share-square-size;
width: $share-square-size;
height: $share-square-size;
}
.m-share-square {
$position: -$share-square-size - 10px;
@extend .share-square-common;
border: none;
font-size: 1em;
padding: 0;
position: absolute;
right: 50%;
bottom: 50%;
-webkit-appearance: none;
> a {
@extend .share-square-common;
position: absolute;
opacity: 0;
overflow: hidden;
font-size: 1.1em;
-webkit-transition:all .15s ease-in-out;
&:nth-of-type(3) {
left: 0;
bottom: 0;
}
&:nth-of-type(1) {
top: 0;
left: 0;
}
&:nth-of-type(2) {
top: 0;
left: 0;
}
}
&:hover,
&:active
{
&:before {
content: "";
display: block;
position: absolute;
top: $position;
right: 0;
bottom: 0;
left: $position;
}
> a {
opacity: 1;
&:nth-of-type(3) {
left: $position;
}
&:nth-of-type(1) {
top: $position;
left: $position;
}
&:nth-of-type(2) {
top: $position;
}
}
}
}