Xavier Xavier -4 years ago 93
Javascript Question

How to get right position of Element?

I wish to get the right position of an element. I have tried

attr('right')
and I have read the API document regarding
.position().right
which is non existent (I believe).

http://jsfiddle.net/xavi3r/vcuq7/

Is an example I wish to alert the right value for.

Answer Source

You want to find the value of the CSS right property?

$('#foo').css('right');

In plain Javascript:

document.getElementById('foo').style.right;

But, if you want to find the calculated distance from the right edge of an element to the right edge of another one, then you'll have to do that yourself, combining .position().left and .offsetWidth

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download