Skip to content

Instantly share code, notes, and snippets.

@lifedraft
Created June 10, 2011 15:49
Show Gist options
  • Save lifedraft/1019109 to your computer and use it in GitHub Desktop.
Save lifedraft/1019109 to your computer and use it in GitHub Desktop.
Alternative to adaptjs (http://adapt.960.gs/)
(function(w,d, ranges) {
var html = document.documentElement
window.onresize = function() {
var width = w.innerWidth || d.documentElement.clientWidth || d.body.clientWidth || 0;
for (var i=0; i < ranges.length; i++) {
if (ranges[i] < width) {
break;
};
};
html.className = "js zoom-width-" + (i+1);
};
window.onresize();
})(window, document, [0, 1280, 1420, 1560, 1700, 1840, 1980, 2120, 5000]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment