Created
April 12, 2013 09:55
-
-
Save cdaven/5370941 to your computer and use it in GitHub Desktop.
Simple boilerplate to do Javascript responsive web design (requires jQuery)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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