I need to change the horizontal position of an element. To do this I change its left attribute with .css('left', value). That would move the element relative to where it should be if there was no left value defined.
Now I need to recalculate the position to move the element somewhere else, to do that I need the position where the element should be if I had not changed its left attribute.
I could remove the left value and ask for its position but then the element would also move and would like to avoid that since I may make the element jump between positions.
How could I get the position where the element would be?
The element doesn’t jump between position if you change the
leftstyle multiple times. As long as your function is running, there are no updates in the browser. You can safely reset theleftstyle, get the positon, and then set a newleftvalue.