Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matharchod/1296644 to your computer and use it in GitHub Desktop.
Save matharchod/1296644 to your computer and use it in GitHub Desktop.
A core JavaScript liquid layout function that checks the current width of a browser window and assigns a new class to the BODY accordingly.
//LIQUID LAYOUT
function setScreenClass(){
var fmt = document.documentElement.clientWidth;
var cls = (fmt>640&&fmt<=800)?'screen_low':(fmt>800&&fmt<=1024)?'screen_med':(fmt>1024&&fmt<=1280)?'screen_high':(fmt>1280)?'screen_wide':'screen_low';
document.body.className=cls;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment