diff --git a/js/boxesFx.js b/js/boxesFx.js index 6fdc232..f1d4d95 100644 --- a/js/boxesFx.js +++ b/js/boxesFx.js @@ -67,7 +67,7 @@ // the panels this.panels = [].slice.call( this.el.querySelectorAll( '.panel' ) ); // total number of panels (4 for this demo) - //this.panelsCount = this.panels.length; + this.slidesCount = this.panels.length; this.panelsCount = 4; // current panel“s index this.current = 0; @@ -157,10 +157,10 @@ var self = this, currentPanel = this.panels[ this.current ]; if( dir === 'next' ) { - this.current = this.current < this.panelsCount - 1 ? this.current + 1 : 0; + this.current = this.current < this.slidesCount - 1 ? this.current + 1 : 0; } else { - this.current = this.current > 0 ? this.current - 1 : this.panelsCount - 1; + this.current = this.current > 0 ? this.current - 1 : this.slidesCount - 1; } // next panel to be shown