The CSS tag ‘margin’ is actually a shorthand for the four separate margin values, top/left/bottom/right. Use css('marginTop')
, etc. – note they will have ‘px’ on the end if you have specified them that way.
Use parseInt()
around the result to turn it in to the number value.
NB. As noted by Omaty, the order of the shorthand ‘margin’ tag is:
top right bottom left
– the above list was not written in a way intended to be the list order, just a list of that specified in the tag.