Skip to content

Instantly share code, notes, and snippets.

@xyqfer
Created September 29, 2013 07:05
Show Gist options
  • Save xyqfer/6750018 to your computer and use it in GitHub Desktop.
Save xyqfer/6750018 to your computer and use it in GitHub Desktop.
预加载js
/* 需配合 load.js 使用 */
var preload;
if (/*@cc_on!@*/false) {
preload = function(src) {
new Image().src = src;
};
} else {
preload = function(src) {
var obj = document.createElement("object");
obj.width = 0;
obj.height = 0;
obj.data = src;
document.body.appendChild(obj);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment