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?
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?
If I understood your question correctly, it would look something like this:
function getAbsDiff(A, B)
{
return Math.abs(A - B);
}
Would that be it? Could you be more clear by kindness?
$('.elemento-1').height() - $('.elemento-2').height()
Here is the solution I found: