Made “prel()” also load previous-previuos and next-next images
This commit is contained in:
parent
707d7f7c8f
commit
32a1ab4f3c
1 changed files with 18 additions and 8 deletions
26
pfaltgall
26
pfaltgall
|
@ -413,30 +413,40 @@ function prel() {
|
|||
pages=Math.round(th/ph),
|
||||
sy=Math.round(md.scrollTop),
|
||||
page=Math.round(pages-(th-sy)/ph)+1,
|
||||
img,
|
||||
u;
|
||||
img;
|
||||
//console.log(ph+" "+th+" "+pages+" "+sy+" "+page);
|
||||
if (page>1) {//current
|
||||
img=document.getElementById("img"+(page-2));
|
||||
if (img.src==phimgurl) {
|
||||
u=imgurls[page-2];
|
||||
img.src=u;
|
||||
img.src=imgurls[page-2];
|
||||
img.loading="eager";
|
||||
}
|
||||
}
|
||||
if (page<pages) {//next
|
||||
img=document.getElementById("img"+(page-1));
|
||||
if (img.src==phimgurl) {
|
||||
u=imgurls[page-1];
|
||||
img.src=u;
|
||||
img.src=imgurls[page-1];
|
||||
img.loading="eager";
|
||||
}
|
||||
}
|
||||
if (page>2) {//previous
|
||||
img=document.getElementById("img"+(page-3));
|
||||
if (img.src==phimgurl) {
|
||||
u=imgurls[page-3];
|
||||
img.src=u;
|
||||
img.src=imgurls[page-3];
|
||||
img.loading="eager";
|
||||
}
|
||||
}
|
||||
if (page+1<pages) {//next-next
|
||||
img=document.getElementById("img"+page);
|
||||
if (img.src==phimgurl) {
|
||||
img.src=imgurls[page];
|
||||
img.loading="eager";
|
||||
}
|
||||
}
|
||||
if (page>3) {//previous-previous
|
||||
img=document.getElementById("img"+(page-4));
|
||||
if (img.src==phimgurl) {
|
||||
img.src=imgurls[page-4];
|
||||
img.loading="eager";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue