Last active
October 9, 2019 14:03
-
-
Save kfranqueiro/756b0203724b593aedfd415d9be1effb to your computer and use it in GitHub Desktop.
Bookmarklet to create a window and resize it multiple times (for condensing breakpoint screenshots into gifs)
This file contains 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() { | |
const bg = document.createElement('div'); | |
bg.style.position = 'absolute'; | |
bg.style.top = '0'; | |
bg.style.width = '100%'; | |
bg.style.height = '100%'; | |
bg.style.background = '#000'; | |
bg.style.zIndex = '99999'; | |
document.body.appendChild(bg); | |
const widths = [375, 552, 728, 904, 1080]; | |
const num = widths.length; | |
const h = window.outerHeight; | |
const win = window.open(location.href, 'resize', | |
`left=5,top=0,width=${widths[0]},height=${h}`); | |
setTimeout(() => { | |
widths.forEach((w, i) => setTimeout(() => win.resizeTo(w, h), 1000 * i)); | |
setTimeout(() => bg.remove(), 1000 * num); | |
}, 5000); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment