弹出层在屏幕居中

 

调用函数即可

function screen_center(e){
var w=window.screen.width;//屏幕分辨率的宽
var h=window.screen.height;//屏幕分辨率的高
var left = (w/2) - parseInt($(".wanfan .rule .rule-txt").width())/2;
var top = (h/2) - parseInt($(".wanfan .rule .rule-txt").height())/2;
e.css({'top':top+'px','left':left+'px'});
}

posted @ 2016-09-05 14:38  春风得意之时  阅读(234)  评论(0编辑  收藏  举报