Skip to content

Instantly share code, notes, and snippets.

@first-developer
Created May 29, 2013 05:11
Show Gist options
  • Save first-developer/5668107 to your computer and use it in GitHub Desktop.
Save first-developer/5668107 to your computer and use it in GitHub Desktop.
A CodePen by first-developer. Compute window size on resizing - Code use to compute window size when the browser is resizing
var windowResize = function(fun){
var oldresize = window.onresize;
window.onresize = function(e) {
if (typeof oldresize == 'function') oldresize(e);
fun(e);
}
};
var res = function (e) {
console.log([e.srcElement.outerWidth, e.srcElement.outerHeight]);
};
windowResize(res);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment