From a38ff55da0b7435d64425b9808ee2c1e112faf47 Mon Sep 17 00:00:00 2001 From: Bala Clark Date: Sat, 3 Sep 2011 22:04:38 +0200 Subject: [PATCH] moved window.scroll to the draw method so that it is always called regardless of the navigation method --- lib/ComicBook.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ComicBook.js b/lib/ComicBook.js index 1f98954..c00474e 100755 --- a/lib/ComicBook.js +++ b/lib/ComicBook.js @@ -445,7 +445,7 @@ function ComicBook(id, srcs, opts) { pages[i] = this; loaded.push(i); - // start to load from the begining if loading started midway + // start to load from the beginning if loading started midway if (i === no_pages-1 && loaded.length !== no_pages) { i = -1; } @@ -458,6 +458,7 @@ function ComicBook(id, srcs, opts) { //console.log(loaded[loaded.length-1]); + // double page mode needs an extra page added to the buffer padding = (options.displayMode === "double") ? 1 : 0; // start rendering the comic when the buffer level has been reached (FIXME: buggy, fails if trying to load the last couple of pages) @@ -606,6 +607,9 @@ function ComicBook(id, srcs, opts) { if (getHash() !== pointer) { setHash(pointer + 1); } + + // make sure the top of the page is in view + window.scroll(0, 0); }; /** @@ -778,8 +782,6 @@ function ComicBook(id, srcs, opts) { e.stopPropagation(); - window.scroll(0, 0); // make sure the top of the page is in view - // western style (left to right) if (!options.manga) { if (side === "left") { ComicBook.prototype.drawPrevPage(); }