瀏覽代碼

相册预览

sugangqiang 2 年之前
父節點
當前提交
552eb718eb
共有 1 個文件被更改,包括 14 次插入3 次删除
  1. 14 3
      public/static/js/common/Feng.js

+ 14 - 3
public/static/js/common/Feng.js

@@ -347,13 +347,24 @@ var Feng = {
     showImg: function(context) {                                        //传一个<img>对像
     	var pic = $(context);
     	var src = pic.attr("src");
+        var prev = pic.parent().prev();
+        var _title = prev.text();
+        var sn = _title.lastIndexOf(".");
+        var suffix = _title.substring(sn + 1, _title.length).toLowerCase();
+        var title = "图片预览";
+        var allowedPicTypes = ["jpg","jpeg","gif","png"];
+        if(allowedPicTypes.indexOf(suffix) > -1){
+            title = _title;
+        }
+        src='<div id`="#pics" style="padding:0;margin:0;background:#000;"><img id="_pic0002" layer-src="'+src+'" src="'+src+'" style="display:block;width:60%;height:auto; margin:0 auto;padding:0px;"/></div>';
         layer.open({
-            type:2,
-            title:"图片预览",
+            type:1,
+            title:title,
             fixed:false,
             area: ['80%', '80%'],
             content:src,
-            maxmin:true
+            maxmin:true,
+            shade:0
         })
     	/*var sbp = window.top.$("#showBigPic");
     	sbp.empty();