diff --git a/src/css/modules/layer/default/layer.css b/src/css/modules/layer/default/layer.css index 54a6aeee..75b23654 100644 --- a/src/css/modules/layer/default/layer.css +++ b/src/css/modules/layer/default/layer.css @@ -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 { diff --git a/src/modules/layer.js b/src/modules/layer.js index 95619737..9d5cbf57 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -1412,6 +1412,8 @@ layer.photos = function(options, loop, key){ loadImage(data[start].src, function(img){ layer.close(dict.loadi); + var alt = data[start].alt||''; + //切换图片时不出现动画 if(key) options.anim = -1; @@ -1449,15 +1451,36 @@ layer.photos = function(options, loop, key){ isOutAnim: false, skin: 'layui-layer-photos' + skin('photos'), content: '
' - +''+ (data[start].alt||'') +'' + +''+ alt +'' +function(){ + var tip = '
'; + if(data.length > 1){ - return '
' - +'
' - +'
'+ (data[start].alt || '') +''+ dict.imgIndex +' / '+ data.length +'
' - +'
' + tip += ''; + + if(alt===''){ + tip += '
'+ dict.imgIndex +' / '+ data.length +'查看原图
'; + } + else{ + tip += '
'+ alt +''+ dict.imgIndex +' / '+ data.length +'查看原图
'; + } + + tip += '
'; } - return ''; + else if(data.length === 1){ + if(alt===''){ + tip = '
查看原图
'; + } + else{ + tip += '
'+ alt +'查看原图
'; + tip += '
'; + } + } + else{ + tip = ''; + } + + return tip; }() +'', success: function(layero, index){