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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -