From dffb753261f2028fcf640dbfe59be30a81fce911 Mon Sep 17 00:00:00 2001 From: Mathijs de Bruin Date: Wed, 12 Feb 2014 13:51:39 +0100 Subject: [PATCH] Patch from #34 for goToPage issue with loop: false --- src/swipeview.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/swipeview.js b/src/swipeview.js index 56b0a00..c68d350 100644 --- a/src/swipeview.js +++ b/src/swipeview.js @@ -224,6 +224,22 @@ var SwipeView = (function (window, document) { } this.__flip(); + + // Hide the next page if we decided to disable looping + if (!this.options.loop) { + //reset all pages visibillity + this.masterPages[0].style.visibility = ''; + this.masterPages[1].style.visibility = ''; + this.masterPages[2].style.visibility = ''; + //if current page firs or last we get number of masterpage an hide it + if (this.page === 0) { + this.masterPages[0].style.visibility = 'hidden'; + } + if (this.page == this.options.numberOfPages - 1) { + nextPage = this.currentMasterPage <= 1 ? this.currentMasterPage + 1 : 0; + this.masterPages[nextPage].style.visibility = 'hidden'; + } + } }, next: function () {