Adjust scroll when switching between pages