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

JQuery 实现两列等高并自适应高度

时间:2016-12-22 00:09:12      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:cti   class   高度   div   bsp   doc   style   height   原理   

想要使用 JQuery 实现两列等高并自适应高度,其实也很简单,原理就是取得左右两边的高度,然后判断这个值,把大的值赋给小的就行了。看代码:

$(document).ready(function() {
    var _leftheight = jQuery(".left").height();
    var _rightheight = jQuery(".right").height();
    if (_leftheight > _rightheight) {
        jQuery(".right").height(_leftheight);
    } else {
        jQuery(".left").height(_rightheight);
    }
});

 

JQuery 实现两列等高并自适应高度

标签:cti   class   高度   div   bsp   doc   style   height   原理   

原文地址:http://www.cnblogs.com/wuxibolgs329/p/6209427.html

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