0

I have make a script for make columns the same height. This is my script:

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

equalHeight($(".list-links li"));

But i have a problem. In my website, i use jquery ui core. But i want delete that jquery ui. But if I remove the jquery ui. Then this script does not work anymore. Why?

Thanks for helping.

2
  • Post a link to a working demo. Commented Sep 8, 2012 at 15:48
  • have you written this code in the ui core file by chance? :) Commented Sep 8, 2012 at 15:53

2 Answers 2

2

jQuery's .outerHeight doesn't work as a setter method as you can see from the documentation. So, this line of code

group.outerHeight(tallest);

doesn't have any effect without jQuery UI.

jQuery UI wraps .inner* and .outer* methods and extend them with a setter method as you can see in the excerpt below from jquery.ui.core.js.

...
$.fn[ "outer" + name] = function( size, margin ) {
  if ( typeof size !== "number" ) {
    return orig[ "outer" + name ].call( this, size );
  }

  return this.each(function() {
    $( this).css( type, reduce( this, size, true, margin ) + "px" );
  });
};
...

These setters, for instance .outerHeight, sets the height of the element without the padding, border and optionally the margin.

Sign up to request clarification or add additional context in comments.

Comments

0

The script snippet has, at least what I can tell, nothing to do with the UI core (widget interaction). I guess you are calling a UI core widget method somewhere, check error console, probably an undefined function or non-object as soon as you remove the UI core.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.