Fix page sliding logic