Skip to content

Instantly share code, notes, and snippets.

@cdaven
Created April 12, 2013 09:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cdaven/5370941 to your computer and use it in GitHub Desktop.
Save cdaven/5370941 to your computer and use it in GitHub Desktop.
Simple boilerplate to do Javascript responsive web design (requires jQuery)
var reflowDocument = function () {
var viewportWidth = jQuery(window).width();
// do stuff here
};
jQuery(document).ready(function($) {
var reflowTimer = null;
$(window).on('resize', function () {
clearTimeout(reflowTimer);
reflowTimer = setTimeout(reflowDocument, 100);
});
// First reflow
reflowDocument();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment