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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -