jQuery等高列 [英] jQuery Equal Height Columns

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

问题描述

http://shoes4school.project-x.me/get-involved.html

有人可以告诉我我在做错jQuery列的错误吗...尝试了几种不同的方法后,我无法使它正常工作...

Can someone please tell me what i'm doing wrong the the jQuery column faux... I can not get it to work after trying several different methods...

我正在使用的代码是...我的网址在上方

The code i'm using is... my url is above

$ j(.content-block").height(Math.max($(#right").height(),$(.content-block").height()));

$j(".content-block").height(Math.max($("#right").height(), $(".content-block").height()));

推荐答案

如何伪造网页上的列

(function($){
// add a new method to JQuery

$.fn.equalHeight = function() {
   // find the tallest height in the collection
   // that was passed in (.column)
    tallest = 0;
    this.each(function(){
        thisHeight = $(this).height();
        if( thisHeight > tallest)
            tallest = thisHeight;
    });

    // set each items height to use the tallest value found
    this.each(function(){
        $(this).height(tallest);
    });
}
})(jQuery);

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

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