Skip to content

Instantly share code, notes, and snippets.

@walaura
Last active September 26, 2017 10:25
Show Gist options
  • Save walaura/543bffd8892df704195a2c2fe42f11e2 to your computer and use it in GitHub Desktop.
Save walaura/543bffd8892df704195a2c2fe42f11e2 to your computer and use it in GitHub Desktop.
(function(){
var target = 960;
var $body = document.querySelector('#container');
$body.style.width = target+'px';
$body.style.height = $body.offsetHeight+'px';
$body.style.transformOrigin = '0 0';
window.addEventListener('resize',function(ev) {
window.scaleMultiplier = window.innerWidth/target;
$body.style.transform = 'scale('+window.scaleMultiplier+')';
});
window.dispatchEvent(new Event('resize'));
})();
@walaura
Copy link
Author

walaura commented Sep 26, 2017

hey i made this into a real library! https://github.com/walaura/desktop-viewport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment