<h1>Social Button Share <span>Animation</span></h1>
<p>Demo social button animation with actions that start with a click in the icon that is show in the firt screen. a simple animations very nice for the browser. <b>TweenMax</b></p>
<div id="socialShare">
<div class="socialBox pointer">
<span class="fa fa-share-alt"></span>
<div id="socialGallery">
<div class="socialToolBox">
<a class="facebook" href=""><i class="fa fa-facebook"></i></a>
<a class="google" href=""><i class="fa fa-google-plus"></i></a>
<a class="instagram" href=""><i class="fa fa-instagram"></i></a>
<a class="tumblr" href=""><i class="fa fa-tumblr"></i></a>
<a class="twitter" href=""><i class="fa fa-twitter"></i></a>
<a class="youtube" href=""><i class="fa fa-youtube"></i></a>
</div>
</div>
</div>
</div>
*,
*:before,
*:after {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
body {
background: #0AF;
color: #FFF;
}
h1 {
text-align: center
}
h1 span {
display: block
}
p {
color: rgba(0, 0, 0, .5);
margin: 0 auto 4em;
max-width: 400px;
text-align: center
}
#socialShare {
width: 100%;
margin-top: 15px;
text-align: center;
}
#socialShare a,
#socialShare > .socialBox {
position: relative;
float: none;
display: inline-block;
color: #fff;
font-size: 20px;
padding: 5px;
background-color: transparent;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
border-radius: 50%;
}
#socialShare a {
background-color: rgba(0, 0, 0, 0.2);
}
#socialShare > * > span {
background-color: rgba(0, 0, 0, 0.6);
box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.15);
display: block;
color: #fff;
font-size: 16px;
padding: 8px;
width: 24px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 50%;
-webkit-transform: scale(1);
-moz-transform: scale(1);
transform: scale(1);
-webkit-transition: all .35s ease-in-out;
-moz-transition: all .35s ease-in-out;
transition: all .35s ease-in-out;
}
#socialShare > * > span:hover,
#socialShare > .open > span {
-webkit-transform: scale(1.25);
-moz-transform: scale(1.25);
transform: scale(1.25);
-webkit-transition: all .15s ease-in-out;
-moz-transition: all .15s ease-in-out;
transition: all .15s ease-in-out;
}
#socialGallery {
left: 50%;
margin: 0 auto 0;
position: absolute;
top: 60px;
transform: translate(-50%, 0);
visibility: hidden;
width: 400px;
}
#socialGallery a {
visibility: hidden;
opacity: 0;
margin: 5px 2px;
background-color: rgba(0, 0, 0, 0.6);
position: relative;
top: 10px;
}
#socialGallery a > span {
position: relative;
top: 4px;
left: 4px;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
}
.socialToolBox {
cursor: default;
}
.pointer {
cursor: pointer
}
.facebook:hover {
background: #3b5998 !important
}
.google:hover {
background: #dd4b39 !important
}
.instagram:hover {
background: #517fa4 !important
}
.tumblr:hover {
background: #32506d !important
}
.twitter:hover {
background: #00aced !important
}
.youtube:hover {
background: #bb0000 !important
}
@media only screen and (max-width: 480px) {
#socialGallery {
width: 120px;
}
}
// add this rail gallery effect
$(document).on('click', '#socialShare > .socialBox', function() {
var self = $(this);
var element = $('#socialGallery a');
var c = 0;
if (self.hasClass('animate')) {
return;
}
if (!self.hasClass('open')) {
self.addClass('open');
TweenMax.staggerTo(element, 0.3, {
opacity: 1,
visibility: 'visible'
},
0.075);
TweenMax.staggerTo(element, 0.3, {
top: -12,
ease: Cubic.easeOut
},
0.075);
TweenMax.staggerTo(element, 0.2, {
top: 0,
delay: 0.1,
ease: Cubic.easeOut,
onComplete: function() {
c++;
if (c >= element.length) {
self.removeClass('animate');
}
}
},
0.075);
self.addClass('animate');
} else {
TweenMax.staggerTo(element, 0.3, {
opacity: 0,
onComplete: function() {
c++;
if (c >= element.length) {
self.removeClass('open animate');
element.css('visibility', 'hidden');
};
}
},
0.075);
}
});
This Pen doesn't use any external CSS resources.