Fixed #119 - slide box events

This commit is contained in:
Max Lynch
2013-11-15 21:54:47 -06:00
parent d349c100fb
commit 314156b3ca
6 changed files with 35 additions and 6 deletions

View File

@ -12,6 +12,7 @@
initialize: function(opts) {
var _this = this;
this.slideChanged = opts.slideChanged || function() {};
this.el = opts.el;
this.pager = this.el.querySelector('.slide-box-pager');
@ -120,9 +121,15 @@
content.classList.add('slide-box-animating');
content.style.webkitTransform = 'translate3d(' + -offsetX + 'px, 0, 0)';
var lastSlide = this.slideIndex;
// Update the slide index
this.slideIndex = Math.ceil(offsetX / slideWidth);
if(lastSlide !== this.slideIndex) {
this.slideChanged && this.slideChanged(this.slideIndex);
}
this._updatePager();
},