Skip to content

Commit

Permalink
Update example and fix bug with goTo same index
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Duarte committed Sep 3, 2015
1 parent 481444e commit b5ccfe1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions examples/animations.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ <h2>Animations</h2>

<!-- SLIDER STARTS -->
<div class="Wallop Wallop--slide">
<div class="Wallop-item Wallop-item--current"><img src="imgs/1.jpg"></div>
<div class="Wallop-item"><img src="imgs/2.jpg"></div>
<div class="Wallop-item"><img src="imgs/3.jpg"></div>
<div class="Wallop-item"><img src="imgs/4.jpg"></div>
<div class="Wallop-item"><img src="imgs/5.jpg"></div>
<div class="Wallop-list">
<div class="Wallop-item Wallop-item--current"><img src="imgs/1.jpg"></div>
<div class="Wallop-item"><img src="imgs/2.jpg"></div>
<div class="Wallop-item"><img src="imgs/3.jpg"></div>
<div class="Wallop-item"><img src="imgs/4.jpg"></div>
<div class="Wallop-item"><img src="imgs/5.jpg"></div>
</div>

<button class="Wallop-buttonPrevious">Previous</button>
<button class="Wallop-buttonNext">Next</button>
Expand Down
2 changes: 2 additions & 0 deletions js/Wallop.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@

// Method to add classes to the right elements depending on the index passed
WS.goTo = function (index) {
if (index === this.currentItemIndex) { return; }

// Check if it's a carousel and if so, change index to be last item when clicking previous on first item
if (this.options.carousel && index === -1) { index = this.allItemsArrayLength - 1; }
else if (index > this.allItemsArrayLength || index < 0) { return; }
Expand Down
2 changes: 1 addition & 1 deletion js/Wallop.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b5ccfe1

Please sign in to comment.