Skip to content

Instantly share code, notes, and snippets.

@gauntface
Created December 4, 2012 13:26
Show Gist options
  • Save gauntface/4203847 to your computer and use it in GitHub Desktop.
Save gauntface/4203847 to your computer and use it in GitHub Desktop.
Scaling vs Zooming
var scaleElementWidth = $('body').width();
var scaleElementHeight = $('body').height();
var windowWidth = $(window).width();
var windowHeight = $(window).height();
var wRatio = windowWidth/scaleElementWidth;
var hRatio = windowHeight/scaleElementHeight;
var ratio = Math.min(wRatio, hRatio);
$('body').css('-webkit-transform', 'scale('+ratio+')');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment