jQuery Equal Height Columns

时间:2011-08-13 22:24:28

标签: height equals

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

有人可以告诉我,我在做什么错误的jQuery专栏...我尝试了几种不同的方法后无法让它工作......

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

之上

$ j(“。content-block”)。height(Math.max($(“#right”)。height(),$(“。content-block”)。height());;

2 个答案:

答案 0 :(得分:2)

如何在网页上设置虚拟列

(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);

答案 1 :(得分:0)

Firebug显示此错误:

preloadImages is not defined
 preloadImages([