diff --git a/src/baguetteBox.js b/src/baguetteBox.js index 8fa2af04..0cce83bd 100644 --- a/src/baguetteBox.js +++ b/src/baguetteBox.js @@ -307,6 +307,12 @@ case 27: // Esc hideOverlay(); break; + case 36: // Home + showFirstImage(event); + break; + case 35: // End + showLastImage(event); + break; } } @@ -598,6 +604,22 @@ return show(currentIndex - 1); } + // Return false at the left end of the gallery + function showFirstImage(event) { + if (event) { + event.preventDefault(); + } + return show(0); + } + + // Return false at the right end of the gallery + function showLastImage(event) { + if (event) { + event.preventDefault(); + } + return show(currentGallery.length - 1); + } + /** * Move the gallery to a specific index * @param `index` {number} - the position of the image