summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--js/lightbox.js14
-rw-r--r--js/lightbox_lite.js4
2 files changed, 13 insertions, 5 deletions
diff --git a/js/lightbox.js b/js/lightbox.js
index ae7309a..12c1f69 100644
--- a/js/lightbox.js
+++ b/js/lightbox.js
@@ -306,6 +306,7 @@ Lightbox.prototype = {
var objBottomNavCloseLink = document.createElement("a");
objBottomNavCloseLink.setAttribute('id','bottomNavClose');
objBottomNavCloseLink.setAttribute('href','#');
+ objBottomNavCloseLink.setAttribute('accesskey',"B");
objBottomNavCloseLink.onclick = function() { myLightbox.end(); return false; }
objBottomNav.appendChild(objBottomNavCloseLink);
@@ -543,10 +544,12 @@ Lightbox.prototype = {
// Update to 2.02+
keyboardAction: function(e) {
- if (e == null) { // ie
+ if (e == null) { // ie
keycode = event.keyCode;
+ escapeKey = 27;
} else { // mozilla
keycode = e.which;
+ escapeKey = e.DOM_VK_ESCAPE;
}
// Instead of the above code, (starting with 'if ...') Roel replaced it with the code below,
@@ -562,14 +565,17 @@ Lightbox.prototype = {
key = String.fromCharCode(keycode).toLowerCase();
- if((key == 'x') || (key == 'o') || (key == 'c')){ // close lightbox
+ // close lightbox (x, o, c, ESC)
+ if((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)){
myLightbox.end();
- } else if(key == 'p' || keycode == 37 || keycode == 8 || keycode == 100){ // display previous image
+ // display previous image (p, <-, backspace, ????)
+ } else if(key == 'p' || keycode == 37 || keycode == 8 || keycode == 100){
if(activeImage != 0){
myLightbox.disableKeyboardNav();
myLightbox.changeImage(activeImage - 1);
}
- } else if(key == 'n' || keycode == 39 || keycode == 32 || keycode == 102){ // display next image
+ // display next image (n, ->, space, ????)
+ } else if(key == 'n' || keycode == 39 || keycode == 32 || keycode == 102){
if(activeImage != (imageArray.length - 1)){
myLightbox.disableKeyboardNav();
myLightbox.changeImage(activeImage + 1);
diff --git a/js/lightbox_lite.js b/js/lightbox_lite.js
index f5cccd4..659eac4 100644
--- a/js/lightbox_lite.js
+++ b/js/lightbox_lite.js
@@ -142,12 +142,14 @@ function pause(numberMillis) {
function getKey(e){
if (e == null) { // ie
keycode = event.keyCode;
+ escapeKey = 27;
} else { // mozilla
keycode = e.which;
+ escapeKey = e.DOM_VK_ESCAPE;
}
key = String.fromCharCode(keycode).toLowerCase();
- if(key == 'x'){ hideLightbox(); }
+ if(key == 'x' || key == 'c' || keycode == escapeKey){ hideLightbox(); }
}