Skip to content

Commit

Permalink
adding normalize option
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpf committed Jun 30, 2016
1 parent 92336f3 commit 4255048
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/js/core.js
Expand Up @@ -131,6 +131,7 @@ var defaults = {
control: undefined,
controlInverse: false,
controlBy: 'slide', //or 'container'
normalize: true,
// Swiping/no swiping
allowSwipeToPrev: true,
allowSwipeToNext: true,
Expand Down Expand Up @@ -903,7 +904,9 @@ s.updateActiveIndex = function () {
}
}
// Normalize slideIndex
if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;
if(s.params.normalize){
if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;
}
// for (i = 0; i < s.slidesGrid.length; i++) {
// if (- translate >= s.slidesGrid[i]) {
// newActiveIndex = i;
Expand Down Expand Up @@ -1861,9 +1864,11 @@ s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
s.updateProgress(translate);

// Normalize slideIndex
for (var i = 0; i < s.slidesGrid.length; i++) {
if (- Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {
slideIndex = i;
if(s.params.normalize){
for (var i = 0; i < s.slidesGrid.length; i++) {
if (- Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {
slideIndex = i;
}
}
}

Expand Down

0 comments on commit 4255048

Please sign in to comment.