Chapter 24. Layer Slider

IN THIS CHAPTER

  • Sliding Around

A handy piece of interactivity is to allow the user to move a layer around the screen not by dragging it, but by controlling it with the keyboard. This isn't too hard to accomplish, but users are accustomed to holding down a key and having the effect of that key be repeated. For example, when I press the “a” key on my word processor and hold it down, I don't expect a single “a,” I expect “aaaaaaaaaaa.” Visitors to your Web site will expect the same thing. If you're using keys to move layers around the screen, users will expect holding down a key to continue to move a layer, and that's what this section of code is.

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.