Font Awesome icon hover effect from top to bottom
-
26-12-2019 - |
Question
I'm using Font Aewsome for my social icons, working with Bootstrap 3.
I want a hover effect like this one on the bottom: example
I have a list for my social icons :
<ul class="social-buttons">
<li class="youtube"><a href="#" title="Follow us on Youtube"><i class="fa fa-youtube fa-lg"></i></a></li>
<li class="twitter"><a href="#" title="Follow us on Twitter"><i class="fa fa-twitter fa-lg"></i></a></li>
<li class="xing"><a href="#" title="Follow us on Xing"><i class="fa fa-xing fa-lg"></i></a></li>
<li class="rss"><a href="#" title="Check out our RSS"><i class="fa fa-rss fa-lg"></i></a></li>
</ul>
For my CSS i have this:
.social-buttons {
position: absolute;
left: 70%;
top: 6px;
}
.social-buttons li {
list-style-type: none;
float: left;
margin: 9px 9px 9px 9px;
position: relative;
}
.social-buttons li a {
padding: 2px 2px 2px 2px;
display: block;
}
.social-buttons-footer {
position: relative;
left: -49px;
}
.social-buttons-footer li {
list-style-type: none;
float: left;
margin: 8px 8px 8px 8px;
}
.social-buttons-footer li a {
padding: 2px 2px 2px 2px;
display: block;
}
.fa-youtube, .fa-twitter, .fa-xing, .fa-rss {
color: #000000;
}
.fa-lg:hover{
color: #ffffff;
}
.fa-2x{
color: #000000;
}
.fa-2x:hover{
color: #ffffff;
}
// Hover Effect ---------------------------------------------------------------------------------------------------------------------------------------------
.youtube a:hover{
background-color: #db2c2c;
-webkit-animation: toBottomFromTop 0.3s;
-moz-animation: toBottomFromTop 0.3s;
animation: toBottomFromTop 0.3s;
color: #ffffff;
}
.twitter a:hover{
background-color: #83d0f5;
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
-ms-transition: all ease 0.3s;
-o-transition: all ease 0.3s;
transition: all ease 0.3s;
}
.xing a:hover{
background-color: #a2d123;
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
-ms-transition: all ease 0.3s;
-o-transition: all ease 0.3s;
transition: all ease 0.3s;
}
.rss a:hover{
background-color: #fe9c01;
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
-ms-transition: all ease 0.3s;
-o-transition: all ease 0.3s;
transition: all ease 0.3s;
}
I have searched google the last few hours and i could only find examples where they use sprites or anything like that. I don't really know how to do it. Where should i put the icon that should be exchanged when hovered ? I know how to do it with sprites - there i use the position. But how do i use it here? I tried something else for the youtube hover: but that looks like a big bug! Could someone teach me or tell me where to find a tut? would be nice.
Solution
I have build the effect you need here on JsFiddle.
You just have to add your AwsomeFont items now.
I have added overflow: hidden;
to the parents and moved the single elements with margin: -x px 0 0 0
on an hover event.