Skip to content

Instantly share code, notes, and snippets.

@midoghranek
Created August 5, 2014 21:18
Show Gist options
  • Save midoghranek/4997612cae377e009585 to your computer and use it in GitHub Desktop.
Save midoghranek/4997612cae377e009585 to your computer and use it in GitHub Desktop.
Socialhover icons for blogger.com
<div id='social'>
<a class='facebook' title='facebook' href='#'>
<i class="fa fa-facebook"></i>
</a>
<a class='twitter' title='twitter' href='#'>
<i class="fa fa-twitter"></i>
</a>
<a class='gplus' title='Google plus' href='#'>
<i class="fa fa-google-plus"></i>
</a>
<a class='skype' title='skype' href='#'>
<i class="fa fa-skype"></i>
</a>
</div>
<style>
/* SocialHover buttons by Mohamed Abo El-Ghranek */
/* font awesome icons */
@import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
/* open sans font */
@import url("//fonts.googleapis.com/css?family=Open+Sans");
* {
margin:0;
padding:0;
outline:0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#social {
text-align: center;
width: 100%;
font-family: 'Open Sans', sans-serif;
color: #FFF;
font-size: 14px;
line-height: 20px;
letter-space: .05px;
}
#social a {
width: 35px;
height: 35px;
line-height: 35px;
text-align: center;
display: inline-block;
position: relative;
border-radius: 5px;
background-color: #555;
}
#social a .fa {
color: #FFF;
}
#social a:hover {
-webkit-transform:scale(1.2);
-moz-transform:scale(1.2);
-o-transform:scale(1.2);
transition:all .2s ease;
-webkit-transition:all .2s ease;
-moz-transition:all .2s ease;
-o-transition:all .2s ease;
z-index: 5;
}
#social a span {
position: absolute;
left: 50%;
color: #FFF;
display: none;
border-bottom: 2px solid #38c;
padding-bottom: 8px;
background-color: #555;
top: -30px;
height: 20px;
line-height: 20px;
border-radius: 5px;
font-size: 80%;
white-space: nowrap;
}
#social .facebook:hover {
background-color: #3b5998;
}
#social .twitter:hover {
background-color: #55acee;
}
#social .gplus:hover {
background-color: #dd4b39;
}
#social .skype:hover {
background-color: #00aff0;
}
#social .github:hover {
background-color: #666;
}
</style>
<script>
/* SocialHover buttons by Mohamed Abo El-Ghranek */
$(document).ready(function() {
$( "#social a" ).each(function() {
var tipt = $(this).attr('title');
$(this).attr('title','');
$(this).append('<span>');
$(this).children('span').text(tipt);
var spanWidth = $(this).children('span').width() + 20;
var spanMarg = 0 - spanWidth/2;
$(this).children('span').css('width',spanWidth);
$(this).children('span').css('margin-left',spanMarg);
$(this).hover (
function() {
$(this).children('span').fadeIn();
$('#social a').css('opacity','.1');
$(this).css('opacity','1');
}, function() {
$(this).children('span').fadeOut();
$('#social a').css('opacity','1');
}
);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment