Skip to content

Instantly share code, notes, and snippets.

@webshru
Last active March 31, 2020 09:29
Show Gist options
  • Save webshru/4512cd19047bca5cc2b667df01569151 to your computer and use it in GitHub Desktop.
Save webshru/4512cd19047bca5cc2b667df01569151 to your computer and use it in GitHub Desktop.
Настройка окна для шаринга
const openWindowShare = (name, evt) => {
const href = evt.currentTarget.href
const PARAMS = {
vk: {
width: 650,
height: 570
},
fb: {
width: 600,
height: 745
},
ok: {
width: 588,
height: 658
},
tw: {
width: 600,
height: 253
}
}
const width = PARAMS[name].width
const height = PARAMS[name].height
const top = (window.innerHeight - height) / 2
const left = (window.innerWidth - width) / 2
window.open(href, ``, `width=${width}, height=${height}, top=${top}, left=${left}`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment