Skip to content

Instantly share code, notes, and snippets.

@mohamnag
Created November 3, 2014 09:15
Show Gist options
  • Save mohamnag/47ce52e2d90ff01f17a2 to your computer and use it in GitHub Desktop.
Save mohamnag/47ce52e2d90ff01f17a2 to your computer and use it in GitHub Desktop.
Facebook share button without using official JavaScript plugin
<style>
.fb-share-button {
background: #4c69ba;
background: -webkit-gradient(linear, center top, center bottom, from(#4c69ba), to(#3b55a0));
background: -webkit-linear-gradient(#4c69ba, #3b55a0);
background: gradient(linear, center top, center bottom, from(#4c69ba), to(#3b55a0));
background: linear-gradient(#4c69ba, #3b55a0);
border: none;
-webkit-border-radius: 2px;
color: #fff;
cursor: pointer;
font-weight: bold;
height: 20px;
line-height: 20px;
padding: 0;
text-shadow: 0 -1px 0 #354c8c;
white-space: nowrap;
.image {
background-image: url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/y5/r/KxVPs0eEy36.png);
background-size: 30px 72px;
background-repeat: no-repeat;
display: inline-block;
height: 14px;
width: 14px;
left: 0;
margin: 0 0 0 4px;
position: relative;
top: 3px;
vertical-align: top;
background-position: 0 -42px;
}
.text {
padding: 0 5px 0 0;
position: relative;
vertical-align: top;
-webkit-font-smoothing: antialiased;
font-size: 11px;
}
a {
color: $white;
}
&:hover {
background: -webkit-gradient(linear, center top, center bottom, from(#3b55a0), to(#4c69ba));
background: -webkit-linear-gradient(#3b55a0, #4c69ba);
background: gradient(linear, center top, center bottom, from(#3b55a0), to(#4c69ba));
background: linear-gradient(#3b55a0, #4c69ba);
}
}
</style>
<div class="fb-share-button">
<a onclick="window.open('http://www.facebook.com/sharer.php?u='+document.URL, '_blank', 'location=yes,height=210,width=500,scrollbars=yes,status=yes');">
<i class="image"></i>
<span class="text">Share</span>
</a>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment