您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

jquery实现弹出层完美居中效果_jquery

2025/3/29 14:42:30发布25次查看
jquery实现弹出层完美居中效果
复制代码 代码如下:
showdiv($(#pop));
function showdiv(obj){
 $(obj).show();
 center(obj);
 $(window).scroll(function(){
  center(obj);
 });
 $(window).resize(function(){
  center(obj);
 });
}function center(obj){
 var windowwidth = document.documentelement.clientwidth;  
 var windowheight = document.documentelement.clientheight;  
 var popupheight = $(obj).height();  
 var popupwidth = $(obj).width();   
 $(obj).css({  
  position: absolute,  
  top: (windowheight-popupheight)/2+$(document).scrolltop(),  
  left: (windowwidth-popupwidth)/2  
 }); 
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product