Ox.ImageElement: handle image error, use new LoadingScreen (start/stop)

This commit is contained in:
rolux 2013-11-20 09:11:53 +01:00
parent 94a18a2711
commit 1f926c83ea

View file

@ -32,6 +32,7 @@ Ox.ImageElement = function(options, self) {
width: self.options.width,
height: self.options.height
})
.start()
.appendTo(that);
loadImage();
@ -42,7 +43,10 @@ Ox.ImageElement = function(options, self) {
self.$image.off({load: showImage}).remove();
}
self.$image = $('<img>')
.one({load: showImage})
.one({
error: stopLoading,
load: showImage
})
.attr({src: self.options.src});
}
@ -60,10 +64,14 @@ Ox.ImageElement = function(options, self) {
}
function showImage() {
self.$screen.remove();
self.$screen.stop().remove();
self.$image.appendTo(that);
}
function stopLoading() {
self.$screen.stop();
}
that.css = function(css) {
that.$element.css(css);
self.$screen && self.$screen.css(css);