layer.photos在父窗口打开
作者:互联网
1.在父窗体里
window.photosJSON = { "title": "", //相册标题 "id": 123, //相册id "maxmin": true, "start": 0, //初始显示的图片序号,默认0 "data": [ //相册包含的图片,数组格式 ] }
2.子窗体调用
$("#imglst").on("click", 'img', function () { var _this = $(this); top.photosJSON.data = []; var index = _this.parent().index(); top.photosJSON.start = index; $("#imglst").find("img").each(function () { top.photosJSON.data.push({ "src": $(this).attr("layer-src"), "pid": 0, "thumb": "", "alt": "" }); }) top.layer.photos({ photos: top.photosJSON }) })
标签:index,layer,窗口,top,photos,photosJSON,data 来源: https://www.cnblogs.com/siyisiyue/p/14653036.html