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

  • Home
  • SEARCH
  • 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 7408321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:53:41+00:00 2026-05-29T05:53:41+00:00

I usually use this to match elements heights: function equalHeight(group) { tallest = 0;

  • 0

I usually use this to match elements heights:

function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
    }

    $(function() {
        equalHeight($('.column'));
    });

However, in my case I need to match elements to their nearest sibling not by class, with the following example

    <div class="post">
        <div class="leftCol">
            <h2>This is a post headline</h2>
            <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volut</p>
        </div>
        <div class="rightCol">
            <ul>
                <li></li>
            </ul>           
        </div>
    </div><!--/post-->

There will be multiple (over 15) instances per page of this structure. I don’t want to match the height of “.leftCol” to the height of “.rightCol” across the board – that is I don’t want every “.leftCol” to match every “.rightCol” on the page, just within each “.post” group – match “.leftCol” height to its immediate sibling of the “.rightCol” class… any ideas?

  • 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-29T05:53:42+00:00Added an answer on May 29, 2026 at 5:53 am

    If what you’re trying to do is to set each leftCol/rightCol pair to the taller of either one, but only within the pair and you want to do the same for all pairs, you can do it like this:

    $(".post .leftCol").each(function() {
        var $left = $(this);
        var $right = $left.next();
        var maxHeight = Math.max($left.height(), $right.height());
        $left.height(maxHeight);
        $right.height(maxHeight);
    });
    

    This code works as follows:

    1. For each .post .leftCol object
    2. Get the .leftCol jQuery object
    3. Get the matching .rightCol jQuery object using .next()
    4. Find out the max height between the two of them
    5. Set this .leftCol and .rightCol pair each to that max height

    Note: you may be able to solve this problem with CSS alone. See CSS – Equal Height Columns?.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I usually use this: <html lang=en> . However, I am working on a website
I usually use this line to import file from out of the current folder
I haven't play enough with this and usually use mocks, but I wonder what
I'll preface this by saying that I usually work in C#/.Net. Normally, I use
I do not usually use JavaScript, and cannot see why this is not working.
I usually use code like this: using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[MyConn].ConnectionString)) { var
I usually use this private void ensureDiscoverable() { if(D) Log.d(TAG, ensure discoverable); if (mBluetoothAdapter.getScanMode()
I usually use this: HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(postURL);
I usually use C++ stdlib map whenever I need to store some data associated
I usually use IIS in conjunction with the OutSystems development platform, which does code-generation

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.