jQuery: The Write Less, Do More JavaScript Library

Keyboard navigation Escape key not works in Opera browser

Project:jQuery Lightbox Plugin (balupton edition)
Version:1.0.1-final
Component:Code
Category:bug report
Priority:normal
Assigned:FredXY
Status:closed
Description

Original function KeyboardNav_Action seems to be taken from http://warren.mesozen.com/2007/09/28/jquery-lightbox-version-04/ and maybe even from older scripts. This function not works in Opera browser on escape key.
Now i there this

KeyboardNav_Action: function (e) {
if(!e){e=window.event;}
var keycode=e.keyCode?e.keyCode:e.which;
key=String.fromCharCode(keycode).toLowerCase();
if ( key === this.keys.close || keycode === 27 )
{        return $.Lightbox.finish();                }
if ( key === this.keys.prev || keycode === 37 )
{
return $.Lightbox.showImage($.Lightbox.images.prev());
}
if ( key === this.keys.next || keycode === 39 )
{
return $.Lightbox.showImage($.Lightbox.images.next());
}
return true;
},

This solution bellow works for me, instead of that function which is there. Of course it has to be reviewed by someone experienced.

KeyboardNav_Action: function (e) {
if(!e){e=window.event;}
var keycode=e.keyCode?e.keyCode:e.which;
key=String.fromCharCode(keycode).toLowerCase();
if ( key === this.keys.close || keycode === 27 )
{        return $.Lightbox.finish();                }
if ( key === this.keys.prev || keycode === 37 )
{
return $.Lightbox.showImage($.Lightbox.images.prev());
}
if ( key === this.keys.next || keycode === 39 )
{
return $.Lightbox.showImage($.Lightbox.images.next());
}
return true;
},

Comments

#1

Status:patch (code needs review)» fixed

Fixed and will be in the next release.

#2

Fixed release is now out, it is version 1.1.0-final.

#3

Status:fixed» closed