In conjunction with styles.css change, changed W, and S keys to scroll image vertically and removed page change from Up and Down, leaving A, D, Left, and Right as keys for changing page. Page returns to the top when changing page. W and S scroll behavior is not smooth. Up and Down scroll relies on browser's in-built keyboard scrolling functionality.
const display = document.getElementById('dest');\r
display.style.backgroundImage = `url("${current.src}")`;\r
\r
+ scroll(0,0)\r
+\r
document.getElementById('page-num')\r
.innerText = [\r
(pageNum + 1).toLocaleString(),\r
switch (event.key.toLowerCase()) {\r
// Previous Image\r
case 'w':\r
+ scrollBy(0, -40);\r
+ break;\r
case 'a':\r
changePage(currentPage - 1);\r
break;\r
// Next Image\r
case ' ':\r
case 's':\r
+ scrollBy(0, 40);\r
+ break;\r
case 'd':\r
changePage(currentPage + 1);\r
break;\r
changePage(currentPage - 1);\r
break;\r
case 38: //up\r
- changePage(currentPage - 1);\r
break;\r
case 39: //right\r
changePage(currentPage + 1);\r
break;\r
case 40: //down\r
- changePage(currentPage + 1);\r
break;\r
}\r
-};
\ No newline at end of file
+};\r