Looks like you're almost there. One thing to consider is that .offset().top gives the position relative to the whole document, not the parent container. If #calcchat is scrollable, you might want to calculate the position relative to that container instead. Using .position().top instead of .offset().top might give more consistent results in this case.