fix: PDF/word图片模式预览时, 下翻图片时频繁请求图片资源

pull/35/head
ZhengJin Fang 2021-11-10 16:27:55 +08:00 committed by GitHub
parent 82c7b59650
commit 727e9ae9ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -19,9 +19,13 @@ function checkImgs() {
} }
function loadImg(el) { function loadImg(el) {
var loaded = el.getAttribute("loaded");
if (!Boolean(loaded)) {
var source = el.getAttribute("data-src"); var source = el.getAttribute("data-src");
el.setAttribute("loaded", true);
el.src = source; el.src = source;
} }
}
// var mustRun = 500 // var mustRun = 500
// function throttle(fn, mustRun) { // function throttle(fn, mustRun) {
// var timer = null; // var timer = null;