$('friends').css('top') returns a string, you will need to convert it to int before you can use it to subtract from newTop
parseInt($('friends').css('top'), 10)
Would do the trick
You also need to use the class id or class id in your jQuery selector, either '#friends' or '.friends' , but I assume you are looking for something with a friends id
try it
width: "+="+((newTop - parseInt($('#friends').css('top'), 10))*3),
Jimmy source share