this.slides = this.options.photoUrls.map(photoUrl => { const slide = new SlideView({ size: this.options.size, photoUrl: photoUrl }); slide.on('click', () => { this.showNextSlide(); }); return slide; });
function _createSlides() { this.slides = []; this.currentIndex = 0; for(var i = 0; i <this.options.data.length; i++) { var slide = new SlideView({ size: this.options.size, photoUrl: this.options.data[i] }); this.slides.push(slide); slide.on('click', this.showNextSlide.bind(this)); } this.showCurrentSlide(); }
function _createSlides() { this.slides = []; this.currentIndex = 0; for (var i = 0; i < this.options.data.length; i++) { var slide = new SlideView({ size: this.options.size, photoUrl: this.options.data[i] }); this.slides.push(slide); // adding click listener // on click, calling .showNextSlide() // note that we're binding showNextSlide to the slideshow // to maintain the correct context when called slide.on('click', this.showNextSlide.bind(this)); } this.showCurrentSlide(); }