mirror of
https://github.com/fengyuanchen/viewerjs.git
synced 2026-02-01 16:32:50 +00:00
fix: should define viewing first
This commit is contained in:
parent
8b308d62fb
commit
34134d6fe6
@ -263,24 +263,6 @@ export default {
|
||||
once: true,
|
||||
});
|
||||
|
||||
if (image.complete) {
|
||||
this.load();
|
||||
} else {
|
||||
addListener(image, EVENT_LOAD, onLoad = this.load.bind(this), {
|
||||
once: true,
|
||||
});
|
||||
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
// Make the image visible if it fails to load within 1s
|
||||
this.timeout = setTimeout(() => {
|
||||
removeClass(image, CLASS_INVISIBLE);
|
||||
this.timeout = false;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
this.viewing = {
|
||||
abort() {
|
||||
removeListener(element, EVENT_VIEWED, onViewed);
|
||||
@ -301,6 +283,24 @@ export default {
|
||||
},
|
||||
};
|
||||
|
||||
if (image.complete) {
|
||||
this.load();
|
||||
} else {
|
||||
addListener(image, EVENT_LOAD, onLoad = this.load.bind(this), {
|
||||
once: true,
|
||||
});
|
||||
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
// Make the image visible if it fails to load within 1s
|
||||
this.timeout = setTimeout(() => {
|
||||
removeClass(image, CLASS_INVISIBLE);
|
||||
this.timeout = false;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user