I would like to add to an element’s position a dynamic amount e.g. 40px to the right.
This code below for example gets an element’s right offset relative to the appropriate parent:
$('#example').css('right')
But it returns a string such as ’12px’, I want a method I can add numbers to.
As an analogue I am able to add a given amount to the width of an element as below:
$('#example').width($('#example').width()+355)
I would like to be able to do something similar to the position.
Thanks.
The
+=will take care of that for you.jQuery 1.6+