使用JQuery的等高高度的列 [英] Columns of Equal Height with JQuery

查看:125
本文介绍了使用JQuery的等高高度的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以把JQuery用来创建等高的列吗?如果是,如何?



感谢

解决方案

,并找到最高的。

  var maxHeight = 0; 
$(。column)。each(function(){
maxHeight = $(this).height()> maxHeight?$(this).height():maxHeight;
href =http:/// href =href =http://www.hp.com/) /jsbin.com/afupe/2/editrel =nofollow noreferrer> http://jsbin.com/afupe/2/edit


Can we put JQuery to use to create columns of equal height? If yes, how?

Thanks

解决方案

Cycle through each column, and find the tallest. Then set all to that height.

var maxHeight = 0;
$(".column").each(function(){
  maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
}).height(maxHeight);​

Online Demo: http://jsbin.com/afupe/2/edit

这篇关于使用JQuery的等高高度的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆