Saturday, 7 September 2013

How to change the top margin of an element according to it's height?

How to change the top margin of an element according to it's height?

I have a simple code here to raise the top margin of a tooltip by it's
height.
$("#tooltip").css({'marginTop':'-' + $("#tooltip").height});
I am using jQuery 1.9.1 with UI 1.9.2, and am not sure why this does not
work.
tooltip is the element, margintop should be set to - + tooltip.height
example
tooltip.height = 50px, margin-top:-50px;
Could someone point out my error?
Thanks

No comments:

Post a Comment