Revision: 52920
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 5, 2011 11:02 by FatFolderDesigner
Initial Code
var sizeable = 'body,#master,#content,#posts,#sidebar,#footer,#comments'; var sizes = {'450':'phone','750':'tablet','1000':'desktop'}; $(document).ready(function(){ $(window).resize(); }); $(window).resize(function(classes){ $.each(sizes,function(k,v){ var w = parseInt($(window).width()); if(w>=k){ $(sizeable).removeClass().addClass(v); } }); });
Initial URL
http://fatfolderdesign.com/488/css/better-flexible-site-layout-with-resize-detection
Initial Description
I've previously posted this here: http://snipplr.com/view/59044/flexible-site-layout-with-resize-detection/ This new version is short and more efficient, plus it no longer shows 1 (harmless) error on launch. Works the same as last time, the sizable object has the size to add the class too all the sizable elements, so for this example if the screen is less that 450px it'll add the class "phone" to the body (and the other elements), and if it's larger than 750px, but not 1000px, it'll give it the tablet layout. More information about the script is at the link, questions/comments/concerns can be sent to be from here or the comments section at the link.
Initial Title
Flexible Site Layout With Resize Detection, now improved!
Initial Tags
resize, mobile
Initial Language
jQuery