goToSlide function extended with additional parameter "duration"