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 6756003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:28:15+00:00 2026-05-26T13:28:15+00:00

How would I add to the code below to work out if a DIV

  • 0

How would I add to the code below to work out if a DIV has any margin-top/margin-bottom? The situation I have at the moment is that I have 2 columns (DIV’s) 1 have a margin-top and the other doesn’t which causes the columns not to line up correctly.

Sorry the code has been minified and I have lost the original.

$.fn.equalHeight = function (a) {
    var b = {
        delay: 100,
        minusHeight: 0
    };
    var a = $.extend(b, a);
    var c = 0;
    var d = 0;
    var e = $(this);
    setTimeout(function () {
        e.each(function () {
            c = $(this).outerHeight();
            d = c > d ? c : d
        });
        return e.each(function () {
            var b = $(this);
            var c = d - (b.outerHeight() - b.height()) - a.minusHeight;
            var e = jQuery.browser.msie && jQuery.browser.version < 7 ? "height" : "min-height";
            b.css(e, c + "px")
        })
    }, a.delay)
};
  • 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-26T13:28:16+00:00Added an answer on May 26, 2026 at 1:28 pm

    You should add true as a parameter to .outerHeight() so that it includes the margin in the calculations.

    But there is another issue with your code.. You cannot return anything from a timeout, and you seem to have placed your return code in there..

    This means you are breaking the jQuery chaining system..

    Your code should probably be

    $.fn.equalHeight = function(a) {
        var b = {
            delay: 100,
            minusHeight: 0
        };
        var a = $.extend(b, a);
        var c = 0;
        var d = 0;
    
        this.each(function() {
            c = $(this).outerHeight(true);
            d = c > d ? c : d;
        });
        return this.each(function() {
            var b = $(this);
            var c = d - (b.outerHeight(true) - b.height()) - a.minusHeight;
            var e = (jQuery.browser.msie && jQuery.browser.version < 7) ? "height" : "min-height";
            setTimeout( function(){
                b.css(e, c + "px");
            }, a.delay);
        });
    };
    

    Demo at http://jsfiddle.net/gaby/DXHtk/

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

Sidebar

Related Questions

For debugging / performance tests I would like to dynamically add logging code to
I've got the following code for a search form, but how would I add
I would like to simplify my code and add the possible to the css
I would like to do something like the following: def add(a, b): #some code
I don't understand how using a 'challenge token' would add any sort of prevention:
I have some fairly generic code which uses preprocessor macros to add a certain
I have read that some of the JVMs out there can optimize code execution
In my example code below, you can see that I have been trying to
I'd like to write a gmail extension that would add a button on the
I'm using Elmah with ASP.NET and wondering how I would add custom data, such

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.