jQuery实现窗体高度自适应

2016-01-01 11:21:49  访问(1878) 赞(0) 踩(0)




function ChangePageWidth() {
    var isSet = false;

    if ($(".divpagebodyleft"))
        isSet = true;

    if (!isSet)
        return;
        
    var leftWidth = $(".divpagebodyleft").width();

    if (!leftWidth)
        return;
        
        var theWidth = $(this).width();

        

        if (theWidth) {
            theWidth = theWidth - leftWidth - 60;

            if (theWidth <= 0) {
                theWidth = 10;
            }

            $(".divpagebodyright").width(theWidth);
        }
    }


    function ChangePageHeight() {
        if ($("#mainbody")) {
            var theHeight = $(this).height();

            if (theHeight) {
                theHeight = theHeight - 38;

                if (theHeight <= 0) {
                    theHeight = 10;
                }


                $("#mainbody").height(theHeight);
            }
        } 
    }

    $(function() {
        ChangePageWidth();
        ChangePageHeight();
    });
    
    $(window).resize(function() {
        ChangePageWidth();
        ChangePageHeight();
    }); 


标签:jQuery实现窗体高度自适应 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)