Skip to content

Instantly share code, notes, and snippets.

@wplit
Last active February 26, 2021 02:11
Show Gist options
  • Select an option

  • Save wplit/3fdf7ec2516c89bc7029b91ca04f7e47 to your computer and use it in GitHub Desktop.

Select an option

Save wplit/3fdf7ec2516c89bc7029b91ca04f7e47 to your computer and use it in GitHub Desktop.
Make social share links open up new window 600x600 (in center of screen). Add to social share > advanced > javascript
jQuery('#%%ELEMENT_ID%% .oxy-share-button').on('click', function (e) {
let socialWidth = 600;
let socialHeight = 600;
let leftPosition = (window.screen.width / 2) - ((socialWidth / 2) + 10);
let topPosition = (window.screen.height / 2) - ((socialHeight / 2) + 50);
let windowFeatures = "width="+ socialWidth +",height="+ socialHeight +",scrollbars=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,location=no,directories=no";
e.preventDefault();
window.open(
jQuery(this).attr("href"),
"popupWindow",
windowFeatures
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment