loadImage, keep reference in global scope, use local variables for rest
This commit is contained in:
parent
1168abcbb8
commit
cfa530c6cb
1 changed files with 3 additions and 1 deletions
|
@ -177,15 +177,17 @@ requires
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadImages(callback) {
|
function loadImages(callback) {
|
||||||
|
window.OxImageCache = [];
|
||||||
$.getJSON(oxui.path + 'json/ox.ui.images.json', function(data) {
|
$.getJSON(oxui.path + 'json/ox.ui.images.json', function(data) {
|
||||||
var counter = 0,
|
var counter = 0,
|
||||||
length = data.length;
|
length = data.length;
|
||||||
data.forEach(function(src, i) {
|
data.forEach(function(src, i) {
|
||||||
image = new Image();
|
var image = new Image();
|
||||||
image.src = oxui.path + src;
|
image.src = oxui.path + src;
|
||||||
image.onload = function() {
|
image.onload = function() {
|
||||||
(++counter == length) && callback();
|
(++counter == length) && callback();
|
||||||
}
|
}
|
||||||
|
window.OxImageCache.push(image);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue