为 layer.photo 添加“查看原图”按钮

This commit is contained in:
Jack 2022-08-02 14:36:21 +08:00
parent edbedbb550
commit 821de03d8a
2 changed files with 6 additions and 5 deletions

View File

@ -157,7 +157,8 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;}
.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;}
.layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;}
.layui-layer-imgtit em{padding-left:10px; font-style: normal;}
.layui-layer-imgtit em{padding:0 10px; font-style: normal;}
.layui-layer-imgtit>span+a{margin-left: 10px;}
/* 关闭动画 */
@-webkit-keyframes layer-bounceOut {

View File

@ -1327,20 +1327,20 @@ layer.photos = function(options, loop, key){
tip += '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>';
if(alt===''){
tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><em>'+ dict.imgIndex +' / '+ data.length +'</em></span></div>';
tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><em>'+ dict.imgIndex +' / '+ data.length +'</em><a href="'+data[start].src+'" target="_blank">查看原图</a></span></div>';
}
else{
tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><span>'+ alt +'</span><em>'+ dict.imgIndex +' / '+ data.length +'</em></span></div>';
tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><span>'+ alt +'</span><em>'+ dict.imgIndex +' / '+ data.length +'</em><a href="'+data[start].src+'" target="_blank">查看原图</a></span></div>';
}
tip += '</div>';
}
else if(data.length === 1){
if(alt===''){
tip = '';
tip = '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="'+data[start].src+'" target="_blank">查看原图</a></span></div>';
}
else{
tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><span>'+ alt +'</span></span></div>';
tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><span>'+ alt +'</span><a href="'+data[start].src+'" target="_blank">查看原图</a></span></div>';
tip += '</div>';
}
}