javascript - jQuery adding to css element -
i have id of element. need add given value (determined variable in javascript) 1 of element's css attributes. i.e. given element id=my_id
how add x
element's margin-top
attribute?
var x = 20; $('#my_id').css('margin-top', function(index, value) { if (isnan(parseint(value))) return x; return parseint(value) + x });
Comments
Post a Comment