Skip to content

Instantly share code, notes, and snippets.

@mrjones-plip
Created April 19, 2016 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrjones-plip/3d802b70cd471e25ffe0052e00575aae to your computer and use it in GitHub Desktop.
Save mrjones-plip/3d802b70cd471e25ffe0052e00575aae to your computer and use it in GitHub Desktop.
Simple "share" links for SYN Shop
<style>
.share_img {width:50px;}
</style>
<div id="share_links">
<a href="" id="facebook_share"><img class="share_img"
src="/sites/default/files/images/share/facebook.svg"/></a>
<a href="" id="gplus_share"><img class="share_img"
src="/sites/default/files/images/share/gplus.svg"/></a>
<a href="https://www.instagram.com/synshoplv/" ><img class="share_img"
src="/sites/default/files/images/share/instagram.svg"/></a>
<a href="" id="twitter_share"><img class="share_img"
src="/sites/default/files/images/share/twitter.svg"/></a>
</div>
<script>
// grab the current URL and title and concat it into a URL per service
var title = encodeURIComponent(document.title);
var url = encodeURIComponent(window.location.href);
var facebook_url = "http://www.facebook.com/sharer.php?u=" + url + "&t=" + title
+ " &s=100&p[url]=" + url + "&p[images][0]=&p[title]=" + title;
var gplus_url = "https://plus.google.com/share?url=" + url;
var twitter_url = "https://twitter.com/share?url=" + url + "&text=Hey%20check%20this%20out";
// update 3 URLs with dynamic values from current page.
document.getElementById('facebook_share').href = facebook_url;;
document.getElementById('gplus_share').href = gplus_url;
document.getElementById('twitter_share').href = twitter_url;
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment