Skip to content

Commit

Permalink
Issue : Using arrow keys in "ImagePreviewerPlugin" duplicates the rot…
Browse files Browse the repository at this point in the history
…ate buttons and Image not scroll using arrow keys.

Fixed : Create buttons on initialize instead of showPage() and add logic for handling page mechanism to scroll image with arrow keys.
  • Loading branch information
chintankukadiya18 committed Nov 7, 2015
1 parent 5f0e7c4 commit 936f593
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 936f593

Please sign in to comment.