Arrow navigation still active after dismissing lightbox

636 views
Skip to first unread message

Dougal Campbell

unread,
Jun 16, 2009, 2:40:25 PM6/16/09
to fancybox
Fancybox isn't releasing the keyboard events after viewing a gallery.
For example, go to to the Fancybox Examples page (http://
fancy.klade.lv/example) and click on one of the images in the "Image
Gallery" section. Close the lightbox. Now hit your left and right
arrow keys. The lightbox will reload and navigate.

It seems pretty harmless, except that if you have a form on same page
as a lightbox, it can make it hard to edit your text :)

Note, however, that if you close the lightbox by pressing ESC, the key
events properly unbind.

I fixed this locally by adding this line in the close() method, just
before the __cleanup() definition:

$(document).unbind("keydown");

--
Dougal

Forrest Gump

unread,
Jun 16, 2009, 4:57:49 PM6/16/09
to fancybox
I think this is a bug and should get fixed in upcoming versions.

Andreas

ZeB

unread,
Jun 23, 2009, 7:46:27 AM6/23/09
to fancybox
Damn, i noticed the same bug, and post a message today :) (if spam was
less active, i'd have seen your thread).
http://groups.google.com/group/fancybox/browse_thread/thread/2419f6157ad37f5b

This bug is quite annoying while i'm using the left and right arrow
keys for my portfolio navigation.
I'll test your solution Dougal, thx for tip ;)

JFK

unread,
Jun 23, 2009, 2:22:33 PM6/23/09
to fancybox
I had a sneak preview of the new release (still in beta) and this bug
has been corrected.
I am not the developer so don't ask me when the new version will be
available; I also look forward to seeing it soon.
I think your contributions, comments and findings are very useful to
create a better script that we all love (don't we?)

On Jun 23, 4:46 am, ZeB <sebastien.vane...@gmail.com> wrote:
> Damn, i noticed the same bug, and post a message today :) (if spam was
> less active, i'd have seen your thread).http://groups.google.com/group/fancybox/browse_thread/thread/2419f615...

ZeB

unread,
Jun 24, 2009, 7:09:42 AM6/24/09
to fancybox
Dougal's solution works perfectly, but implies that other side scripts
don't call any KeyDown events. From my side, i'm using KeyPress
events, so i can use that temporary solution.
Good to know that a new release will be out and will fix hopefully
that nasty bug :^)

mofle

unread,
Jun 26, 2009, 7:53:29 AM6/26/09
to fancybox
To fix this, just add:
$(document).unbind("keydown");

right below:
$.fn.fancybox.close = function() {
Reply all
Reply to author
Forward
0 new messages