Skip to content

Instantly share code, notes, and snippets.

@ouelletv
Forked from josephabrahams/socialSharePopups.js
Created August 1, 2018 13:58
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ouelletv/8430642243eb2b7fd54dda5693130f2d to your computer and use it in GitHub Desktop.
Save ouelletv/8430642243eb2b7fd54dda5693130f2d to your computer and use it in GitHub Desktop.
Facebook & Twitter Share Popup Windows
export default function() {
document.querySelectorAll('.js-share-facebook-link').forEach(function(el){
el.addEventListener('click', function(e){
var href = e.target.href;
e.preventDefault();
window.open(href, "Facebook", "toolbar=no,location=0,status=no,menubar=no,scrollbars=yes,width=600,height=400,resizable=1");
})
});
document.querySelectorAll('.js-share-twitter-link').forEach(function(el){
el.addEventListener('click', function(e){
var href = e.target.href;
e.preventDefault();
window.open(href, "Twitter", "toolbar=no,location=0,status=no,menubar=no,scrollbars=yes,width=550,height=285,resizable=1");
})
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment