Last active
August 29, 2015 14:08
-
-
Save oliverbenns/2ef7aa1f78a9fe6631fe to your computer and use it in GitHub Desktop.
Social Share Links Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
li | |
a.js-share(href="http://twitter.com/share?text=" + meta.description, target="_blank", data-window-width="650", data-window-height="360") | |
.icon.icon-twitter | |
li | |
a.js-share(href="http://www.facebook.com/sharer.php", target="_blank", data-window-width="900", data-window-height="500") | |
.icon.icon-facebook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function setUpSocialLinks() { | |
var $shareLink = $('.js-share'); | |
$shareLink.on('click', function(e) { | |
e.preventDefault(); | |
var $this = $(this); | |
var windowWidth = $this.data('window-width') ? $this.data('window-width') : 500; | |
var windowHeight = $this.data('window-height') ? $this.data('window-height') : 500; | |
window.open($this.attr("href"), "", "toolbar=0, status=0, width=" + windowWidth + ", height=" + windowHeight); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment