Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增放大一组图片功能 #33

Merged
merged 3 commits into from
Jan 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions public/static/plugs/easy-admin/easy-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,47 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
});
return false;
});

// 放大一组图片
$('body').on('click', '[data-images]', function () {
var title = $(this).attr('data-images'),
// 从当前元素向上找layuimini-upload-show找到第一个后停止, 再找其所有子元素li
doms = $(this).closest(".layuimini-upload-show").children("li"),
// 被点击的图片地址
now_src = $(this).attr('src'),
alt = $(this).attr('alt'),
data = [];
$.each(doms, function(key, value){
var src = $(value).find('img').attr('src');
if(src != now_src){
// 压入其他图片地址
data.push({
"alt": alt,
"pid": Math.random(),
"src": src,
"thumb": src
});
}else{
// 把当前图片插入到头部
data.unshift({
"alt": alt,
"pid": Math.random(),
"src": now_src,
"thumb": now_src
});
}
});
var photos = {
"title": title,
"id": Math.random(),
"data": data,
};
layer.photos({
photos: photos,
anim: 5
});
return false;
});


// 监听动态表格刷新
Expand Down