only add scroll event if the sidebar exists