想要使用 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);
    }
});

 

相关文章:

  • 2022-01-15
  • 2021-12-18
  • 2021-10-08
  • 2022-02-07
  • 2022-12-23
  • 2022-02-07
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2021-06-10
  • 2022-02-17
  • 2022-01-26
相关资源
相似解决方案