Skip to content

Instantly share code, notes, and snippets.

@reubeningber
Created January 20, 2015 19:09
Show Gist options
  • Select an option

  • Save reubeningber/d3a819cb8f7d7085d3b9 to your computer and use it in GitHub Desktop.

Select an option

Save reubeningber/d3a819cb8f7d7085d3b9 to your computer and use it in GitHub Desktop.
sharePopUp.js
var POP_UP_WIDTH = 700,
POP_UP_HEIGHT = 500;
function init() {
$(document).on('click', '.js-share-pop-up', function(e) {
e.preventDefault();
var $this = $(this),
shareURL = $this.data('shareUrl'),
popUpWidth = $this.data('popUpWidth'),
popUpHeight = $this.data('popUpHeight');
openSharePopUp(shareURL, popUpWidth, popUpHeight);
});
}
function openSharePopUp(shareURL, popUpWidth, popUpHeight) {
popUpWidth = popUpWidth || POP_UP_WIDTH;
popUpHeight = popUpHeight || POP_UP_HEIGHT;
window.open(shareURL, '', 'width='+ popUpWidth + ', height=' + popUpHeight + ', menubar=no, toolbar=no');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment