X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/95e1aff23493b3725d5259bcca7bcc79d7d3bc26..HEAD:/app/assets/javascripts/social_share_button.js diff --git a/app/assets/javascripts/social_share_button.js b/app/assets/javascripts/social_share_button.js index 409b2c58a..34db84758 100644 --- a/app/assets/javascripts/social_share_button.js +++ b/app/assets/javascripts/social_share_button.js @@ -2,8 +2,8 @@ function openShareUrl(url, initialWidth = 640, initialHeight = 480) { const width = Math.max(100, Math.min(screen.width, initialWidth)); const height = Math.max(100, Math.min(screen.height, initialHeight)); - const left = (screen.width / 2) - (width / 2); - const top = (screen.height * 0.3) - (height / 2); + const left = screenLeft + ((outerWidth - width) / 2); + const top = screenTop + ((outerHeight - height) / 2); const opts = `width=${width},height=${height},left=${left},top=${top},menubar=no,status=no,location=no`; window.open(url, "popup", opts);