Skip to content

Instantly share code, notes, and snippets.

@Merazsohel
Created February 27, 2018 08:39
Show Gist options
  • Save Merazsohel/9f6ba737620680cb17a53d3f64686119 to your computer and use it in GitHub Desktop.
Save Merazsohel/9f6ba737620680cb17a53d3f64686119 to your computer and use it in GitHub Desktop.
Social share
<a href="https://www.facebook.com/sharer/sharer.php?u={{ urlencode(Request::fullUrl()) }}"
target="_blank">
Share on Facebook
</a>
<a href="https://twitter.com/intent/tweet?url={{ urlencode(Request::fullUrl()) }}"
target="_blank">
Share on Twitter
</a>
<a href="https://plus.google.com/share?url={{ urlencode(Request::fullUrl()) }}"
target="_blank">
Share on Google
</a>
<script>
var popupMeta = {
width: 400,
height: 400
}
$(document).on('click', '.social-share', function(event){
event.preventDefault();
var vPosition = Math.floor(($(window).width() - popupMeta.width) / 2),
hPosition = Math.floor(($(window).height() - popupMeta.height) / 2);
var url = $(this).attr('href');
var popup = window.open(url, 'Social Share',
'width='+popupMeta.width+',height='+popupMeta.height+
',left='+vpPsition+',top='+hPosition+
',location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1');
if (popup) {
popup.focus();
return false;
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment