/** * 弹窗效果 * content:需要弹出的内容,可以是html * style:弹窗的样式,可自定义 **/ var layerActNum = 0;//活动的弹窗数 function alertPage(content, style) { style = style == null ? '' : style; var closeBtnHtml = ''; layer.open({ type: 1, content: content, style: style, shade: true, shadeClose: true, anim: true, success: function (elem) { $(elem).find('.layermanim').first().append(closeBtnHtml); document.getElementById("dialogCloseBtn" + layerActNum).onclick = function () { layer.close(elem.id.split('box')[1]); } layerActNum++; }, end: function () { layerActNum--; } }); } function DialogLayer(btnID, ctnID) { $("#" + btnID).click(function () { alertPage($("#" + ctnID).html(), 'width:60%;'); }); }