codecomputerlove/PhotoSwipe — Issue #201: Add onSlideshowPrevious and onSlideshowNext events
Author: danieljak
Created: 2011-11-24 15:39:28+00:00
State: open

It would be useful to be able to listen to the next and previous events. Something like this perhaps..:

carousel.js:
PhotoSwipe.Carousel.EventTypes = {

onSlideByEnd: 'PhotoSwipeCarouselOnSlideByEnd',
onSlideshowStart: 'PhotoSwipeCarouselOnSlideshowStart',
onSlideshowStop: 'PhotoSwipeCarouselOnSlideshowStop',
+	onSlideshowPrevious: 'PhotoSwipeCarouselOnSlideshowPrevious',
+	onSlideshowNext: 'PhotoSwipeCarouselOnSlideshowNext'

};

carousel.class.js

previous: function(){

this.stopSlideshow();
this.slideCarousel({x:0, y:0}, Util.TouchElement.ActionTypes.swipeRight, this.settings.nextPreviousSlideSpeed);
+	Util.Events.fire(this, {
+	type: PhotoSwipe.Carousel.EventTypes.onSlideshowPrevious,
+	target: this
+	});

},

next: function(){

this.stopSlideshow();
this.slideCarousel({x:0, y:0}, Util.TouchElement.ActionTypes.swipeLeft, this.settings.nextPreviousSlideSpeed);
+	Util.Events.fire(this, {
+	type: PhotoSwipe.Carousel.EventTypes.onSlideshowNext,
+	target: this
+	});

},

slideshowNext: function(){

this.slideCarousel({x:0, y:0}, Util.TouchElement.ActionTypes.swipeLeft);
+	Util.Events.fire(this, {
+	type: PhotoSwipe.Carousel.EventTypes.onSlideshowNext,
+	target: this
+	});

},

Regards,
Daniel