<link rel="stylesheet" href="${ctxJs }/viewerjs/viewer.css">
<script src="${ctxJs }/viewerjs/viewer.js"></script>
定义一个div,图片区:
<div id="picShow" >
<img data-original="url" src="url"/>
</div>
初始化查看js:
function resetViewer(){
window.addEventListener('DOMContentLoaded', function () {
var galley = document.getElementById('picShow');
var viewer = new Viewer(galley, {
url: 'data-original',
title: function (image) {
return ' (' + (this.index + 1) + '/' + this.length + ')';
},
toolbar:false,
});
});
}
resetViewer();
js下载在:
不预览,直接打开的方法:
window.open(URL,name,specs,replace)
标签:function,resetViewer,140,预览,galley,js,window,var,viewerjs
From: https://blog.51cto.com/u_14816966/5919889