jquery - Add to current CSS top value -
i have jquery:
$(".ta").siblings(".aname:eq(0)").css("top",+=$(".text").height()+15);
but not working. have tried way too:
$(".ta").siblings(".aname:eq(0)").css("top",'+=$(".text").height()+15');
but did not work.
you have grab current top value, , add new value, , append "px" on when set value using .css()
here like:
var element = $(".ta").siblings(".aname:eq(0)"); var currtop = number(element.css("top").replace("px", "")); var amounttoadd = $(".text").height() + 15; $(element).css("top", (currtop + amounttoadd + "px"));
Comments
Post a Comment