Skip to content

Instantly share code, notes, and snippets.

@qizhihere
Created June 22, 2015 03:17
Show Gist options
  • Save qizhihere/8e41b157927615ca97bf to your computer and use it in GitHub Desktop.
Save qizhihere/8e41b157927615ca97bf to your computer and use it in GitHub Desktop.
add multiple window.onload events
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment