Skip to content

Instantly share code, notes, and snippets.

@naupaw
Created December 17, 2019 05:00
Show Gist options
  • Select an option

  • Save naupaw/1c4da6d02e0e6452ef53ad9126a55d83 to your computer and use it in GitHub Desktop.

Select an option

Save naupaw/1c4da6d02e0e6452ef53ad9126a55d83 to your computer and use it in GitHub Desktop.

Revisions

  1. @pedox pedox created this gist Dec 17, 2019.
    18 changes: 18 additions & 0 deletions createPopup.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    export default (url, width, height) => {
    const h = width || 600
    const w = height || 800
    const y = window.top.outerHeight / 2 + window.top.screenY - h / 2
    const x = window.top.outerWidth / 2 + window.top.screenX - w / 2
    window.open(
    url,
    '_blank',
    'toolbar=no,scrollbars=yes,resizable=yes,top=' +
    y +
    ',left=' +
    x +
    ',width=' +
    w +
    ',height=' +
    h
    )
    }