Equations in module

2

I need to get the height of 2 elements, where these elements can have varying heights and then find the difference between their height as in the example:

A = 20 B = 15

| A - B | = 5

How do I do this in an equation with JS?

    
asked by anonymous 05.02.2014 / 01:03

3 answers

11

If I understood your question correctly, it would look something like this:

function getAbsDiff(A, B)
{
   return Math.abs(A - B);
}
    
05.02.2014 / 01:08
0

Would that be it? Could you be more clear by kindness?

$('.elemento-1').height() - $('.elemento-2').height()
    
05.02.2014 / 01:07
0

Here is the solution I found:

link

    
05.02.2014 / 01:15