var top=obj.offset().top; var left=obj.offset().left; $("#mapDiv").css({'top':top-20,'left':left+50});