Add a callback when a new page is selected