Created
January 26, 2019 22:27
-
-
Save Fraasi/39ace4783fed5ddfa00ef628fc6f9e57 to your computer and use it in GitHub Desktop.
Resize browser/electron/extension window based on content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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