changed the timing of menu toggling, because it conflicts with scrolling