Created
April 18, 2010 18:21
-
-
Save subchild/370446 to your computer and use it in GitHub Desktop.
$.resizeEnd()
This file contains 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
jQuery.fn.extend({ | |
/** | |
* Binds new resize handler to window object. For IE and Safari handler is executed on resize completion. | |
* @param newHandler function object | |
*/ | |
resizeEnd: function(newHandler){ | |
$(this).resize(function(){ | |
var handlerCode = newHandler.toString(); // for hash reference | |
if ($.browser.msie || $.browser.safari){ // handle after resize operation is complete (once) | |
if (!GLR.resizeTimeout){ | |
GLR.resizeTimeout = {}; // initiate GLR.resizeTimeout | |
} | |
if (GLR.resizeTimeout[handlerCode] !== null){ // if handler exists... | |
clearTimeout(GLR.resizeTimeout[handlerCode]); // clear timeout since it will be re-assigned later, if need be | |
} | |
GLR.resizeTimeout[handlerCode] = setTimeout(newHandler, 300); // wait before calling handleResize, unless its been reset by a further resize actiong IE or Safari; | |
} | |
else { | |
newHandler(); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment