Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7681009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:14:44+00:00 2026-05-31T18:14:44+00:00

So I’m using some jQuery that I found online. There’s a lot of variations

  • 0

So I’m using some jQuery that I found online. There’s a lot of variations of it that all do the same thing to help you create divs of equal height. The code I’m using is like so when I load a page.

    var highestCol = Math.max($('.equal_height_div1').height(),$('.equal_height_div2').height());
$('.equal_height').css('min-height', highestCol);

Works like a charm.

To get this to work when resizing the browser window, I re-use the same code from above but just put it inside the resize function:

    $(window).resize(function() {
var highestCol = Math.max($('.equal_height_div1').height(),$('.equal_height_div2').height());
$('.equal_height').css('min-height', highestCol);
});

Here’s the challenge: I’m using the 1140grid with responsive layout (http://cssgrid.net/). It resizes divs as you resize the window. So my divs are shrinking in width and the 2nd set of code above works great when the window resizes.

The problem I’m having and would love insight from anyone is how do I destroy the value of the min height on page resize, then run the function again to get the new min-height from the tallest div? The problem is that once the div becomes tall and I resize the window to be wider, the div needs to decrease in height but it is staying with the highest div min-height it reached. This will allow me to constantly update the min-height of the div with a new value and re-calcuate the actual height of the largest div.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:14:45+00:00Added an answer on May 31, 2026 at 6:14 pm

    Unset the min-height so that the div gets height gets recalculated.

    $('document').ready(function(){
    
        var $equal_height = $('.equal_height'),
            $col_a = $('.equal_height_div1');
            $col_b = $('.equal_height_div2');
    
        // calc the highest column
        // we assign this the return value of a function to make sure its always fresh.
        var heighest = function($col_a, $col_b){
            // Cache variables in closure
            var $col_a, $col_b;
            // this is where the magic happens
            return function(){    
                return Math.max( $col_a.height(), $col_b.height() );
            }
        }($col_a, $col_b);
    
        // Run once on ready to equalize columns
        $equal_height.css('minHeight', heighest);
    
        $(window).resize(function(){
           // By unsetting minHeight the column gets its real size back 
           $equal_height.css('minHeight', 0)
                .css('minHeight', heighest);
        });  
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there's a lot of other questions out there that deal with this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.