Skip to content

Instantly share code, notes, and snippets.

@Fraasi
Created January 26, 2019 22:27
Show Gist options
  • Save Fraasi/39ace4783fed5ddfa00ef628fc6f9e57 to your computer and use it in GitHub Desktop.
Save Fraasi/39ace4783fed5ddfa00ef628fc6f9e57 to your computer and use it in GitHub Desktop.
Resize browser/electron/extension window based on content
function resizeWindow() {
const padding = 20 // title bar height without menu in electron
const heightDiff = (document.body.clientHeight - document.documentElement.clientHeight) + padding
window.resizeBy(0, heightDiff)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment