function showpopup(popcontent,poptitle,popwidth,popheight) {
$(".pop_up_Iframe,.bg,.pop_up_box").remove();
var bh =$(document).height();
var bw =$(window).width();
var wh =$(window).height();
$('<iframe scrolling="no" frameborder="no" boder="0" class="pop_up_Iframe"></iframe><div class="bg"></div>').appendTo(document.body).css({width:bw,height:bh,display:"block"});
$(document.body).append(
"<div class='pop_up_box'>"
+"<div class='pop_up_contnet'>"
+"<div class='pop_up_contnet_top'>"
+"<div class='edialogheaderbg_l'>"
+"<div class='edialogheaderbg_r'>"
+"<div class='edialogheadertitle' name='DragTitle'></div>"
+"<div onClick='closeBg();' class='edialogclose' title='点此关闭'></div>"
+"</div>"
+"</div>"
+"</div>"
+"<div class='Guide_content'>"
+"<div class='edialogbodybg_l'>"
+"<div class='edialogbodybg_r'>"
+"<div class='edialogbody'></div>"
+"</div>"
+"</div>"
+"</div>"
+"<div class='edialogfooterbg_l'>"
+"<div class='edialogfooterbg_r'>"
+"<div class='edialogfooterbg'></div>"
+"</div>"
+"</div>"
+"</div>"
+"</div>")
var popcontentlink=popcontent;
$.ajax({
url: popcontentlink,
dataType: 'html',
success: function(data) {
$(".edialogbody").html(data);
},
error: function(json){
alert("Showpopup Error!");
}
});
$('.edialogheadertitle').text(poptitle);
$('.pop_up_box').css({width:popwidth,height:popheight});
var v_left=(bw-popwidth)/2;
var v_top=(wh-popheight)/2;
$('.pop_up_box').css({left:v_left,top:v_top,display:"block"});
};
目前弹出页面的大小虽然根据传进来的宽和高,但实际上还是根据打开页面的动态内容大小而变,我需要每次打开页面大小一致,请问如何修改?
javascript
html
------解决方案--------------------
$('.pop_up_box,.pop_up_Iframe').css({width:popwidth,height:popheight});
var v_left=(bw-popwidth)/2;
var v_top=(wh-popheight)/2;
$('.pop_up_box,.pop_up_Iframe').css({left:v_left,top:v_top,display:"block"});
设置宽度高度top left 不要忘记带上.pop_up_Iframe ,不放心再加上 overflow:hidden 吧