changes in the scroll listener to avoid multiple calls to the container