Skip to content

Commit

Permalink
Merge pull request #79 from jkarkoszka/master
Browse files Browse the repository at this point in the history
prevent to go on out of ranges page
  • Loading branch information
fchasen committed Jan 3, 2014
2 parents a236806 + dddbcaf commit be2c2d0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,16 +583,14 @@ EPUBJS.Book.prototype.prevPage = function() {
};

EPUBJS.Book.prototype.nextChapter = function() {
this.spinePos++;
if(this.spinePos > this.spine.length) return;

this.spinePos++;
return this.displayChapter(this.spinePos);
};

EPUBJS.Book.prototype.prevChapter = function() {
if(this.spinePos < 1) return;
this.spinePos--;
if(this.spinePos < 0) return;

return this.displayChapter(this.spinePos, true);
};

Expand Down

0 comments on commit be2c2d0

Please sign in to comment.