update slide function.