Skip to content

Commit

Permalink
Center share popup inside the browser window
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Dec 19, 2024
1 parent 4d4b798 commit 2c57c66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/social_share_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2c57c66

Please sign in to comment.