Query scrollTop outside of for loop in updatePositions