BNDong/Cnblogs-Theme-SimpleMemory

图片灯箱导致img标签的其他用户自定义的属性失效

Closed this issue · 0 comments

博客园小组相关的用户反馈 https://group.cnblogs.com/topic/116012.html

if (cpb.length > 0 && data.length > 0) {
$.each(data, (i) => {
let tem = $(data[i]);
if (!tem.hasClass('code_img_closed') && !tem.hasClass('code_img_opened')) {
let width = tem.attr('width');
let height = tem.attr('height');
tem.after('<a data-fancybox="gallery" href="'+tem.attr('src')+'"><img ' +
(width ? ' width="' + width + '" ' : '') +
(height ? ' height="' + height + '" ' : '') +
' src="'+tem.attr('src')+'"/></a>');
tem.remove();
}
});