Skip to content

Commit

Permalink
Don't double trigger reach callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Nov 9, 2015
1 parent 38e6962 commit 58e4f5b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,8 @@ s.updateProgress = function (translate) {
translate = s.translate || 0;
}
var translatesDiff = s.maxTranslate() - s.minTranslate();
var wasBeginning = s.isBeginning;
var wasEnd = s.isEnd;
if (translatesDiff === 0) {
s.progress = 0;
s.isBeginning = s.isEnd = true;
Expand All @@ -791,8 +793,8 @@ s.updateProgress = function (translate) {
s.isBeginning = s.progress <= 0;
s.isEnd = s.progress >= 1;
}
if (s.isBeginning) s.emit('onReachBeginning', s);
if (s.isEnd) s.emit('onReachEnd', s);
if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);
if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);

if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);
s.emit('onProgress', s, s.progress);
Expand Down

0 comments on commit 58e4f5b

Please sign in to comment.