图片预览可在viewjs中大图预览&翻页

This commit is contained in:
陈精华
2019-04-26 14:10:37 +08:00
committed by kl
parent ae40d0233b
commit a49ee9d726
3 changed files with 13 additions and 8 deletions

View File

@ -18,20 +18,20 @@
<div class="container">
<#list imgurls as img>
<div class="img-area">
<img class="my-photo" alt="loading" data-src="${img}" src="images/loading.gif">
<img class="my-photo" alt="loading" title="查看大图" style="cursor: pointer;" data-src="${img}" src="images/loading.gif" onclick="changePreviewType('allImages')">
</div>
</#list>
</div>
<img src="images/left.png" style="position: fixed; cursor: pointer; top: 40%; left: 50px; z-index: 999;" alt="PDF预览" onclick="goForPdf()"/>
<img src="images/right.png" style="position: fixed; cursor: pointer; top: 40%; right: 70px; z-index: 999;" alt="使用PDF预览" title="使用PDF预览" onclick="changePreviewType('pdf')"/>
<script>
window.onload=checkImgs;
window.onscroll = throttle(checkImgs);
function goForPdf() {
function changePreviewType(previewType) {
var url = window.location.href;
if (url.indexOf("officePreviewType=image") != -1) {
url = url.replace("officePreviewType=image", "officePreviewType=pdf");
url = url.replace("officePreviewType=image", "officePreviewType="+previewType);
} else {
url = url + "&officePreviewType=pdf";
url = url + "&officePreviewType="+previewType;
}
window.location.href=url;
}

View File

@ -18,7 +18,7 @@
</#if>
<iframe src="/pdfjs/web/viewer.html?file=${finalUrl}" width="100%" frameborder="0"></iframe>
<img src="images/right.png" style="position: fixed; cursor: pointer; top: 40%; right: 50px; z-index: 999;" alt="图片预览" onclick="goForImage()"/>
<img src="images/left.png" style="position: fixed; cursor: pointer; top: 40%; right: 70px; z-index: 999;" alt="使用图片预览" title="使用图片预览" onclick="goForImage()"/>
</body>
<script type="text/javascript">