web hosting
build a website

JQuery social share buttons

Aug 16, 2015   //   by Anthony Devine   //   Website Development tips  //  No Comments

Below is code for JQuery Facebook, Google+ and Twitter social share buttons

<script>
jQuery(document).ready(function() {
var pathname = document.URL;
var summary = document.title;
var facebook = "http://www.facebook.com/sharer/sharer.php?u=" + pathname;
var google = "https://plus.google.com/share?url=" + pathname;
var twitter = "https://twitter.com/intent/tweet?text=" + summary + "&url=" + pathname;
jQuery("#twittershare").attr("href", twitter);
jQuery("#fbshare").attr("href", facebook);
jQuery("#googleshare").attr("href", google);
});
</script>
<div class="socialshare">
<a target="_blank" href="#" id="twittershare"><img src="https://imagelink/AW13/MISC/shareTweet.png" /></a>
            
<a target="_blank" href="#" id="fbshare"><img src="https://imagelink/AW13/MISC/shareFacebook.png" /></a>

<a target="_blank" href="#" id="googleshare"><img src="https://imagelink/AW13/MISC/shareGoog.png" /></a>
</div>