I am building a very simple website with a series of images arranged vertically on a page. I would like to be able to use the up and down arrow keys to smooth scroll from one image to the next, up or down. This way the number of keystrokes required for browsing will be minimized and the unmatched spacing of page down and page up can be avoided.
I imagine that this is going to be a javascript function. However, I am not very experienced using javascript, so I hope you can consider a beginner in the answer. Right now, the images are arranged inside a single div
and separated with br
(multiple line breaks). So, I imagine it might be possible to place an id
in each img
or to place identifying tags around each img
for the javascript to use. Or, perhaps, there is another way to make the javascript recognize the steps for scrolling via arrow keys. What is the best way to do this? Thank you.