arozwalak
3/4/2014 - 6:19 PM

Javascript: Popup window

Javascript: Popup window

function popupwindow(url, title, w, h) {
  var left = (screen.width/2)-(w/2);
  var top = (screen.height/2)-(h/2);
  return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 

$(document).ready(function() {
  $(".share .fb-share-button a").click(function(e) {
      e.preventDefault();
      popupwindow(this.href, 'targetWindow', 500, 300);
  });

  $(".share .tw-share-button a").click(function(e) {
      e.preventDefault();
      popupwindow(this.href, 'targetWindow', 500, 300);
  });
});