Skip to content

Instantly share code, notes, and snippets.

/example.js
Created Feb 21, 2012

Embed
What would you like to do?
JQuery Resize Events
// See: http://ejohn.org/blog/learning-from-twitter/
(function($) {
$(document).ready(function() {
var resizeCallable = function() {
switch (true)
{
case (window.innerWidth <= 768):
// Do some exciting device size specific magic here.
break;
}
};
var didResize = false;
$(window).on('load resize', function() {
didResize = true;
});
setInterval(function() {
if (didResize) {
didResize = false;
resizeCallable();
}
}, 250);
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.