Skip to content

Commit

Permalink
Build update
Browse files Browse the repository at this point in the history
  • Loading branch information
feimosi committed Mar 11, 2017
1 parent 8613150 commit c6db2fc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
40 changes: 25 additions & 15 deletions dist/baguetteBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
};

var trapFocusInsideOverlay = function(event) {
if (overlay.style.display === 'block' && !overlay.contains(event.target)) {
if (overlay.style.display === 'block' && (overlay.contains && !overlay.contains(event.target))) {
event.stopPropagation();
initFocus();
}
Expand Down Expand Up @@ -288,15 +288,15 @@

function keyDownHandler(event) {
switch (event.keyCode) {
case 37: // Left arrow
showPreviousImage();
break;
case 39: // Right arrow
showNextImage();
break;
case 27: // Esc
hideOverlay();
break;
case 37: // Left arrow
showPreviousImage();
break;
case 39: // Right arrow
showNextImage();
break;
case 27: // Esc
hideOverlay();
break;
}
}

Expand Down Expand Up @@ -377,7 +377,9 @@
// Set overlay color
try {
overlay.style.backgroundColor = options.overlayBackgroundColor;
} catch (e) {}
} catch (e) {
// Silence the error and continue
}
}

function showOverlay(chosenImageIndex) {
Expand Down Expand Up @@ -472,7 +474,11 @@

function loadImage(index, callback) {
var imageContainer = imagesElements[index];
if (typeof imageContainer === 'undefined') {
var galleryItem = currentGallery[index];

// Return if the index exceeds prepared images in the overlay
// or if the current gallery has been changed / closed
if (imageContainer === undefined || galleryItem === undefined) {
return;
}

Expand All @@ -485,7 +491,7 @@
}

// Get element reference, optional caption and source path
var imageElement = currentGallery[index].imageElement;
var imageElement = galleryItem.imageElement;
var thumbnailElement = imageElement.getElementsByTagName('img')[0];
var imageCaption = typeof options.captions === 'function' ?
options.captions.call(currentGallery, imageElement) :
Expand Down Expand Up @@ -659,7 +665,12 @@
element.addEventListener(event, callback, useCapture);
} else {
// IE8 fallback
element.attachEvent('on' + event, callback);
element.attachEvent('on' + event, function(event) {
// `event` and `event.target` are not provided in IE8
event = event || window.event;
event.target = event.target || event.srcElement;
callback(event);
});
}
}

Expand Down Expand Up @@ -696,5 +707,4 @@
showNext: showNextImage,
showPrevious: showPreviousImage
};

}));
2 changes: 1 addition & 1 deletion dist/baguetteBox.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c6db2fc

Please sign in to comment.