Created
June 22, 2015 03:17
-
-
Save qizhihere/8e41b157927615ca97bf to your computer and use it in GitHub Desktop.
add multiple window.onload events
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
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