Skip to content

Commit

Permalink
Merge pull request #2 from chintansoni54/bugfix-ImageViewerPlugin
Browse files Browse the repository at this point in the history
Using arrow keys in ImagePreviewerPlugin duplicates the rotate buttons and Image not scroll using arrow keys.
  • Loading branch information
h44z committed Nov 8, 2015
2 parents 5f0e7c4 + 936f593 commit 732f3ac
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ImageViewerPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ function ImageViewerPlugin() {

var imgElement = undefined,
self = this,
rotation = 0;
rotation = 0,
currentPage = 1;

function initCSS() {
var pluginCSS;
Expand Down Expand Up @@ -79,6 +80,7 @@ function ImageViewerPlugin() {
self.onLoad();

initCSS();
initButtons();
};

this.isSlideshow = function () {
Expand Down Expand Up @@ -113,11 +115,15 @@ function ImageViewerPlugin() {

// return a list of tuples (pagename, pagenode)
this.getPages = function () {
return [imgElement];
return [1, 2];
};

this.showPage = function (n) {
initButtons();
if(n === currentPage) {
imgElement.parentNode.scrollTop -= 100;
} else {
imgElement.parentNode.scrollTop += 100;
}
};

this.getPluginName = function () {
Expand Down

0 comments on commit 732f3ac

Please sign in to comment.