Skip to content

Commit

Permalink
Merge pull request nolimits4web#1766 from arthurpf/normalize-option
Browse files Browse the repository at this point in the history
adding normalize option
  • Loading branch information
nolimits4web committed Sep 14, 2016
2 parents f867a10 + 4255048 commit 55a885a
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 @@ -930,7 +931,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 @@ -1888,9 +1891,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 55a885a

Please sign in to comment.