lightgallery 2.5.0-beta.3 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/lightgallery-bundle.css +4 -0
- package/css/lightgallery-bundle.min.css +1 -1
- package/css/lightgallery-core.css +4 -0
- package/css/lightgallery.css +4 -0
- package/lg-settings.d.ts +14 -1
- package/lib/lg-settings.js +2 -0
- package/lib/lg-settings.js.map +1 -1
- package/lib/lightgallery.js +34 -3
- package/lib/lightgallery.js.map +1 -1
- package/lib/plugins/video/lg-video-settings.js.map +1 -1
- package/lightgallery.d.ts +4 -0
- package/lightgallery.es5.js +37 -4
- package/lightgallery.es5.js.map +1 -1
- package/lightgallery.min.js +2 -2
- package/lightgallery.umd.js +37 -4
- package/lightgallery.umd.js.map +1 -1
- package/lit/lightgallery.esm.js +4 -4
- package/lit/lightgallery.umd.js +2 -2
- package/package.json +1 -1
- package/plugins/autoplay/lg-autoplay.es5.js +1 -1
- package/plugins/autoplay/lg-autoplay.min.js +1 -1
- package/plugins/autoplay/lg-autoplay.umd.js +1 -1
- package/plugins/comment/lg-comment.es5.js +1 -1
- package/plugins/comment/lg-comment.min.js +1 -1
- package/plugins/comment/lg-comment.umd.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.min.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
- package/plugins/hash/lg-hash.es5.js +1 -1
- package/plugins/hash/lg-hash.min.js +1 -1
- package/plugins/hash/lg-hash.umd.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
- package/plugins/pager/lg-pager.es5.js +1 -1
- package/plugins/pager/lg-pager.min.js +1 -1
- package/plugins/pager/lg-pager.umd.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
- package/plugins/rotate/lg-rotate.es5.js +1 -1
- package/plugins/rotate/lg-rotate.min.js +1 -1
- package/plugins/rotate/lg-rotate.umd.js +1 -1
- package/plugins/share/lg-share.es5.js +1 -1
- package/plugins/share/lg-share.min.js +1 -1
- package/plugins/share/lg-share.umd.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.min.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
- package/plugins/video/lg-video-settings.d.ts +1 -0
- package/plugins/video/lg-video.es5.js +1 -1
- package/plugins/video/lg-video.es5.js.map +1 -1
- package/plugins/video/lg-video.min.js +1 -1
- package/plugins/video/lg-video.umd.js +1 -1
- package/plugins/video/lg-video.umd.js.map +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +1 -1
- package/plugins/zoom/lg-zoom.es5.js +1 -1
- package/plugins/zoom/lg-zoom.min.js +1 -1
- package/plugins/zoom/lg-zoom.umd.js +1 -1
- package/react/Lightgallery.es5.js +37 -4
- package/react/Lightgallery.es5.js.map +1 -1
- package/react/Lightgallery.umd.js +37 -4
- package/react/Lightgallery.umd.js.map +1 -1
- package/scss/lightgallery-core.scss +3 -0
- package/vue/LightGalleryVue.common.js +48 -5
- package/vue/LightGalleryVue.common.js.map +1 -1
- package/vue/LightGalleryVue.umd.js +48 -5
- package/vue/LightGalleryVue.umd.js.map +1 -1
- package/vue/LightGalleryVue.umd.min.js +2 -2
- package/vue/LightGalleryVue.umd.min.js.map +1 -1
package/lightgallery.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare class LightGallery {
|
|
|
26
26
|
$content: lgQuery;
|
|
27
27
|
$toolbar: lgQuery;
|
|
28
28
|
prevScrollTop: number;
|
|
29
|
+
bodyPaddingRight: number;
|
|
29
30
|
private zoomFromOrigin;
|
|
30
31
|
private currentImageSize?;
|
|
31
32
|
private isDummyImageRemoved;
|
|
@@ -99,6 +100,9 @@ export declare class LightGallery {
|
|
|
99
100
|
*/
|
|
100
101
|
updateSlides(items: GalleryItem[], index: number): void;
|
|
101
102
|
getItems(): GalleryItem[];
|
|
103
|
+
shouldHideScrollbar(): boolean;
|
|
104
|
+
hideScrollbar(): void;
|
|
105
|
+
resetScrollBar(): void;
|
|
102
106
|
/**
|
|
103
107
|
* Open lightGallery.
|
|
104
108
|
* Open gallery with specific slide by passing index of the slide as parameter.
|
package/lightgallery.es5.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* lightgallery | 2.5.0
|
|
2
|
+
* lightgallery | 2.5.0 | June 13th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -96,6 +96,8 @@ var lightGalleryCoreSettings = {
|
|
|
96
96
|
defaultCaptionHeight: 0,
|
|
97
97
|
ariaLabelledby: '',
|
|
98
98
|
ariaDescribedby: '',
|
|
99
|
+
resetScrollPosition: true,
|
|
100
|
+
hideScrollbar: false,
|
|
99
101
|
closable: true,
|
|
100
102
|
swipeToClose: true,
|
|
101
103
|
closeOnTap: true,
|
|
@@ -832,6 +834,7 @@ var LightGallery = /** @class */ (function () {
|
|
|
832
834
|
this.currentItemsInDom = [];
|
|
833
835
|
// Scroll top value before lightGallery is opened
|
|
834
836
|
this.prevScrollTop = 0;
|
|
837
|
+
this.bodyPaddingRight = 0;
|
|
835
838
|
this.isDummyImageRemoved = false;
|
|
836
839
|
this.dragOrSwipeEnabled = false;
|
|
837
840
|
this.mediaContainerPosition = {
|
|
@@ -1179,6 +1182,27 @@ var LightGallery = /** @class */ (function () {
|
|
|
1179
1182
|
return this.settings.dynamicEl || [];
|
|
1180
1183
|
}
|
|
1181
1184
|
};
|
|
1185
|
+
LightGallery.prototype.shouldHideScrollbar = function () {
|
|
1186
|
+
return (this.settings.hideScrollbar &&
|
|
1187
|
+
document.body === this.settings.container);
|
|
1188
|
+
};
|
|
1189
|
+
LightGallery.prototype.hideScrollbar = function () {
|
|
1190
|
+
if (!this.shouldHideScrollbar()) {
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
this.bodyPaddingRight = parseFloat($LG('body').style().paddingRight);
|
|
1194
|
+
var bodyRect = document.documentElement.getBoundingClientRect();
|
|
1195
|
+
var scrollbarWidth = window.innerWidth - bodyRect.width;
|
|
1196
|
+
$LG(document.body).css('padding-right', scrollbarWidth + this.bodyPaddingRight + 'px');
|
|
1197
|
+
$LG(document.body).addClass('lg-overlay-open');
|
|
1198
|
+
};
|
|
1199
|
+
LightGallery.prototype.resetScrollBar = function () {
|
|
1200
|
+
if (!this.shouldHideScrollbar()) {
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
$LG(document.body).css('padding-right', this.bodyPaddingRight + 'px');
|
|
1204
|
+
$LG(document.body).removeClass('lg-overlay-open');
|
|
1205
|
+
};
|
|
1182
1206
|
/**
|
|
1183
1207
|
* Open lightGallery.
|
|
1184
1208
|
* Open gallery with specific slide by passing index of the slide as parameter.
|
|
@@ -1215,6 +1239,7 @@ var LightGallery = /** @class */ (function () {
|
|
|
1215
1239
|
return;
|
|
1216
1240
|
this.lgOpened = true;
|
|
1217
1241
|
this.outer.removeClass('lg-hide-items');
|
|
1242
|
+
this.hideScrollbar();
|
|
1218
1243
|
// Add display block, but still has opacity 0
|
|
1219
1244
|
this.$container.addClass('lg-show');
|
|
1220
1245
|
var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, index);
|
|
@@ -1666,9 +1691,11 @@ var LightGallery = /** @class */ (function () {
|
|
|
1666
1691
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1667
1692
|
setTimeout(function () {
|
|
1668
1693
|
if (_this.getSlideType(currentGalleryItem) === 'image') {
|
|
1694
|
+
var alt = currentGalleryItem.alt;
|
|
1695
|
+
var altAttr = alt ? 'alt="' + alt + '"' : '';
|
|
1669
1696
|
$currentSlide
|
|
1670
1697
|
.find('.lg-img-wrap')
|
|
1671
|
-
.append(utils.getImgMarkup(index, src,
|
|
1698
|
+
.append(utils.getImgMarkup(index, src, altAttr, srcset, sizes, currentGalleryItem.sources));
|
|
1672
1699
|
if (srcset || sources) {
|
|
1673
1700
|
var $img = $currentSlide.find('.lg-object');
|
|
1674
1701
|
_this.initPictureFill($img);
|
|
@@ -2456,7 +2483,9 @@ var LightGallery = /** @class */ (function () {
|
|
|
2456
2483
|
};
|
|
2457
2484
|
LightGallery.prototype.trapFocus = function () {
|
|
2458
2485
|
var _this = this;
|
|
2459
|
-
this.$container.get().focus(
|
|
2486
|
+
this.$container.get().focus({
|
|
2487
|
+
preventScroll: true,
|
|
2488
|
+
});
|
|
2460
2489
|
$LG(window).on("keydown.lg.global" + this.lgId, function (e) {
|
|
2461
2490
|
if (!_this.lgOpened) {
|
|
2462
2491
|
return;
|
|
@@ -2532,7 +2561,9 @@ var LightGallery = /** @class */ (function () {
|
|
|
2532
2561
|
return 0;
|
|
2533
2562
|
}
|
|
2534
2563
|
this.LGel.trigger(lGEvents.beforeClose);
|
|
2535
|
-
|
|
2564
|
+
if (this.settings.resetScrollPosition && !this.settings.hideScrollbar) {
|
|
2565
|
+
$LG(window).scrollTop(this.prevScrollTop);
|
|
2566
|
+
}
|
|
2536
2567
|
var currentItem = this.items[this.index];
|
|
2537
2568
|
var transform;
|
|
2538
2569
|
if (this.zoomFromOrigin && currentItem) {
|
|
@@ -2577,6 +2608,8 @@ var LightGallery = /** @class */ (function () {
|
|
|
2577
2608
|
_this.outer.removeClass('lg-zoom-from-image');
|
|
2578
2609
|
}
|
|
2579
2610
|
_this.$container.removeClass('lg-show');
|
|
2611
|
+
// Reset scrollbar
|
|
2612
|
+
_this.resetScrollBar();
|
|
2580
2613
|
// Need to remove inline opacity as it is used in the stylesheet as well
|
|
2581
2614
|
_this.$backdrop
|
|
2582
2615
|
.removeAttr('style')
|