KutePHP KutePHP - 1 year ago 68
jQuery Question

how to calculate height of elements inside a div in jquery?

I have a div which contains number of elements which user can drag and drop to rearrange inside. Also, he can add new elements from tool bar. I want to increase height of outer div to wrap all those elements. Now they overlap on footer. The challenges I fighting with are -
1. How to find elements which are placed below other. All the elements are have relative positions.
2. Change of height needs to be handled on drop of an element.

I need solution very urgently.


Answer Source

Maybe something like this?

var height = 0;
$("div > *").each(function () {
  height += $(this).height();