Skip to content

Instantly share code, notes, and snippets.

@pritam3010
Forked from ouelletv/socialSharePopups.js
Created July 24, 2021 12:40
Show Gist options
  • Select an option

  • Save pritam3010/73b27506bc238f8439c7e410f852c46a to your computer and use it in GitHub Desktop.

Select an option

Save pritam3010/73b27506bc238f8439c7e410f852c46a 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