Skip to content

Instantly share code, notes, and snippets.

@kfranqueiro
Last active October 9, 2019 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfranqueiro/756b0203724b593aedfd415d9be1effb to your computer and use it in GitHub Desktop.
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)
(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