update position and scroll bar