日期:2014-05-16 浏览次数:20471 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>居中显示</title>
<script type="text/javascript" src="http://www1.zhaopin.com/Publish/Company/common/jquery/1.3.2pack/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    var container = $("#container");
    (function(){
        var _size = _getPageSize();
        container.css({
            height: _size[3]
        });
    })();
    $(window).resize(function(){
        var _size = _getPageSize();
        container.css({
            height: _size[3]
        });
    });
    
    function _getPageSize() {
        var xScroll, yScroll;
        if (window.innerHeight && window.scrollMaxY) {    
            xScroll = window.innerWidth + window.scrollMaxX;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
            xScroll = document.body.scrollWidth;
            yScroll