码迷,mamicode.com
首页 > Web开发 > 详细

在Jquery中让一个容器div显示在屏幕正中央

时间:2019-03-10 20:25:55      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:position   屏幕   ring   height   jquery   content   led   doc   容器   

分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!http://www.captainbed.net

非常简单就实现了,代码不用解释,很容易懂的   
   
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#popupContact").height();
var popupWidth = $("#popupContact").width();
//centering
$("#popupContact").css({
    "position": "absolute",
    "top": windowHeight/2-popupHeight/2,
    "left": windowWidth/2-popupWidth/2
});

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!http://www.captainbed.net

在Jquery中让一个容器div显示在屏幕正中央

标签:position   屏幕   ring   height   jquery   content   led   doc   容器   

原文地址:https://www.cnblogs.com/swdhywhd/p/10506775.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!