Skip to content

Instantly share code, notes, and snippets.

@jgarciaruiz
Created December 16, 2015 14:27
Show Gist options
  • Save jgarciaruiz/a39955959a0927974ddf to your computer and use it in GitHub Desktop.
Save jgarciaruiz/a39955959a0927974ddf to your computer and use it in GitHub Desktop.
Add the class social-button to the links you want to open on a modal window.
function modalPopup(url, width, height) {
var left = (screen.width / 2) - (width / 2),
top = (screen.height / 2) - (height / 2);
window.open(
url,
"",
"menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=" + width + ",height=" + height + ",top=" + top + ",left=" + left
);
}
$(".social-button").on("click", function(e) {
e.preventDefault();
modalPopup($(this).attr("href"), 500, 300);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment