O'Reilly logo

Instant Fancybox by Kyle Diedrick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changing keyboard shortcuts (Advanced)

Fancybox allows users to navigate through an image slideshow with keyboard shortcuts. Let's take a look at changing these from the default settings.

Getting ready

Fancybox relies on jQuery keypress events to determine which key was pressed. Each key is identified by a number that is its charCode. A key's charCode can be found by looking it up on http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes. For more information about retrieving charCodes from jQuery, see http://api.jquery.com/category/events/event-object/ and look at the event.which documentation.

We can change or add keybindings for these actions: next, previous, close, play, and toggle fullscreen. We're going to make the W, A

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required