jquery 弹出窗

<!--[if IE 6]>
<script>
var isIE6 = true;
</script>
<style>
* html { background-image:url(about:blank); background-attachment:fixed; }
* html .mask_content { z-index: 9999; position: absolute !important; left: expression(eval(document.documentElement.scrollLeft + document.documentElement.clientWidth/2 - this.offsetWidth/2));top: expression(eval(document.documentElement.scrollTop + document.documentElement.clientHeight/2 - this.offsetHeight/2)); }
</style>
<![endif]-->
<script>
//通用弹层
function openLay(options) {
var content_html_code = typeof options.content_html_code === 'undefined' ? '' : options.content_html_code,
content_height = typeof options.height === 'undefined' ? 300 : options.height,
content_width = typeof options.width === 'undefined' ? 400 : options.width;

var docE = document.documentElement,
mask = jQuery('<div class="mask"/>').css({position:'absolute','z-index':999,left:'0',top:'0',opacity:'.8',filter:'alpha(opacity=80)','background-color':'#000'}),
iframe = jQuery('<iframe />').css({position:'absolute','100%',height:'100%','z-index':-1,top:0,left:0,filter:'alpha(opacity=0)'}),
content = jQuery('<div class="mask_content">' + content_html_code ),
dom_content = content[0],
dom_mask = mask[0];

mask.width(Math.max(document.body.scrollWidth,docE.scrollWidth)).height(Math.max(document.body.scrollHeight,docE.scrollHeight));
if (typeof isIE6 !== 'boolean') {
content.css({position:'fixed','z-index':9999,content_width,height:content_height,left:'50%',top:'50%','margin-left':-options.width/2,'margin-top':-options.height/2});

}

dom_mask.appendChild(iframe[0]);
document.body.appendChild(dom_mask);
document.body.appendChild(dom_content);



jQuery('#mask_close').click(function(){
jQuery('.mask_content').fadeOut(500);
jQuery('.mask').remove();
jQuery('.mask_content').remove();
})
}
function removMask(){
jQuery('.mask_content').fadeOut(500);
jQuery('.mask').remove();
jQuery('.mask_content').remove();
}
原文地址:https://www.cnblogs.com/jinbiao/p/2295591.html