Merge pull request #301 from fangzhengjin/patch-1

fix: PDF/word图片模式预览时, 下翻图片时频繁请求图片资源
This commit is contained in:
gitchenjh 2021-11-28 17:05:39 +08:00 committed by GitHub
commit 0a5fc1e4a8
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,8 +19,12 @@ function checkImgs() {
}
function loadImg(el) {
var source = el.getAttribute("data-src");
el.src = source;
var loaded = el.getAttribute("loaded");
if (!Boolean(loaded)) {
var source = el.getAttribute("data-src");
el.setAttribute("loaded", true);
el.src = source;
}
}
// var mustRun = 500
// function throttle(fn, mustRun) {