Reputation: 153
How can I get width of element which I css. My code:
$('a').css({'left':-$(this).width()/2})
Upvotes: 0
Views: 39
Reputation: 388436
You can use a callback as the property value which can return the actual style value
$('a').css({
'left': function () {
return -$(this).width() / 2
}
})
Upvotes: 2