1

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

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

1
  • You shouldnt need jQuery to create two column layout. Proper CSS should do that without the JS, is there a reason why you just arent doing a traditional two column css layout?
    – Jim
    Aug 13, 2011 at 22:31

2 Answers 2

2

How to faux columns on webpage

(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
  • This answer doesn't work when smaller divs has margin or padding. Nov 5, 2013 at 9:05
0

Firebug show this error :

preloadImages is not defined
 preloadImages([ 
3
  • I fixed that error but the columns did not faux. I wanted to you js because it's a quick and plus I'm modifying a joomla template...
    – avernon2
    Aug 15, 2011 at 23:31
  • Also this method has worked for me countless times... I'm not sure what the problem is..
    – avernon2
    Aug 15, 2011 at 23:33
  • (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);
    – avernon2
    Aug 3, 2012 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.