lightgallery 2.3.0-beta.4 → 2.3.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.
Files changed (62) hide show
  1. package/lg-settings.d.ts +13 -1
  2. package/lg-utils.d.ts +15 -3
  3. package/lib/lg-settings.js +3 -0
  4. package/lib/lg-settings.js.map +1 -1
  5. package/lib/lg-utils.js +2 -2
  6. package/lib/lg-utils.js.map +1 -1
  7. package/lib/lightgallery.js +16 -4
  8. package/lib/lightgallery.js.map +1 -1
  9. package/lightgallery.es5.js +22 -7
  10. package/lightgallery.es5.js.map +1 -1
  11. package/lightgallery.min.js +2 -2
  12. package/lightgallery.umd.js +22 -7
  13. package/lightgallery.umd.js.map +1 -1
  14. package/lit/lightgallery.esm.js +7 -7
  15. package/lit/lightgallery.umd.js +2 -2
  16. package/package.json +1 -1
  17. package/plugins/autoplay/lg-autoplay.es5.js +1 -1
  18. package/plugins/autoplay/lg-autoplay.min.js +1 -1
  19. package/plugins/autoplay/lg-autoplay.umd.js +1 -1
  20. package/plugins/comment/lg-comment.es5.js +1 -1
  21. package/plugins/comment/lg-comment.min.js +1 -1
  22. package/plugins/comment/lg-comment.umd.js +1 -1
  23. package/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
  24. package/plugins/fullscreen/lg-fullscreen.min.js +1 -1
  25. package/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
  26. package/plugins/hash/lg-hash.es5.js +1 -1
  27. package/plugins/hash/lg-hash.min.js +1 -1
  28. package/plugins/hash/lg-hash.umd.js +1 -1
  29. package/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
  30. package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
  31. package/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
  32. package/plugins/pager/lg-pager.es5.js +1 -1
  33. package/plugins/pager/lg-pager.min.js +1 -1
  34. package/plugins/pager/lg-pager.umd.js +1 -1
  35. package/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
  36. package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
  37. package/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
  38. package/plugins/rotate/lg-rotate.es5.js +1 -1
  39. package/plugins/rotate/lg-rotate.min.js +1 -1
  40. package/plugins/rotate/lg-rotate.umd.js +1 -1
  41. package/plugins/share/lg-share.es5.js +1 -1
  42. package/plugins/share/lg-share.min.js +1 -1
  43. package/plugins/share/lg-share.umd.js +1 -1
  44. package/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
  45. package/plugins/thumbnail/lg-thumbnail.min.js +1 -1
  46. package/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
  47. package/plugins/video/lg-video.es5.js +1 -1
  48. package/plugins/video/lg-video.min.js +1 -1
  49. package/plugins/video/lg-video.umd.js +1 -1
  50. package/plugins/zoom/lg-zoom.es5.js +1 -1
  51. package/plugins/zoom/lg-zoom.min.js +1 -1
  52. package/plugins/zoom/lg-zoom.umd.js +1 -1
  53. package/react/Lightgallery.es5.js +22 -7
  54. package/react/Lightgallery.es5.js.map +1 -1
  55. package/react/Lightgallery.umd.js +22 -7
  56. package/react/Lightgallery.umd.js.map +1 -1
  57. package/vue/LightGalleryVue.common.js +154 -139
  58. package/vue/LightGalleryVue.common.js.map +1 -1
  59. package/vue/LightGalleryVue.umd.js +154 -139
  60. package/vue/LightGalleryVue.umd.js.map +1 -1
  61. package/vue/LightGalleryVue.umd.min.js +2 -2
  62. package/vue/LightGalleryVue.umd.min.js.map +1 -1
@@ -6491,9 +6491,9 @@ var utils = {
6491
6491
  var transform = 'translate3d(' + (x *= -1) + 'px, ' + (y *= -1) + 'px, 0) scale3d(' + scX + ', ' + scY + ', 1)';
6492
6492
  return transform;
6493
6493
  },
6494
- getIframeMarkup: function getIframeMarkup(iframeWidth, iframeHeight, src, iframeTitle) {
6494
+ getIframeMarkup: function getIframeMarkup(iframeWidth, iframeHeight, iframeMaxWidth, iframeMaxHeight, src, iframeTitle) {
6495
6495
  var title = iframeTitle ? 'title="' + iframeTitle + '"' : '';
6496
- return "<div class=\"lg-video-cont lg-has-iframe\" style=\"width:".concat(iframeWidth, "; height: ").concat(iframeHeight, "\">\n <iframe class=\"lg-object\" frameborder=\"0\" ").concat(title, " src=\"").concat(src, "\" allowfullscreen=\"true\"></iframe>\n </div>");
6496
+ return "<div class=\"lg-video-cont lg-has-iframe\" style=\"width:".concat(iframeWidth, "; max-width:").concat(iframeMaxWidth, "; height: ").concat(iframeHeight, "; max-height:").concat(iframeMaxHeight, "\">\n <iframe class=\"lg-object\" frameborder=\"0\" ").concat(title, " src=\"").concat(src, "\" allowfullscreen=\"true\"></iframe>\n </div>");
6497
6497
  },
6498
6498
  getImgMarkup: function getImgMarkup(index, src, altAttr, srcset, sizes, sources) {
6499
6499
  var srcsetAttr = srcset ? "srcset=\"".concat(srcset, "\"") : '';
@@ -6686,6 +6686,7 @@ var lightGalleryCoreSettings = {
6686
6686
  supportLegacyBrowser: true,
6687
6687
  allowMediaOverlap: false,
6688
6688
  videoMaxSize: '1280-720',
6689
+ loadYouTubePoster: true,
6689
6690
  defaultCaptionHeight: 0,
6690
6691
  ariaLabelledby: '',
6691
6692
  ariaDescribedby: '',
@@ -6713,6 +6714,8 @@ var lightGalleryCoreSettings = {
6713
6714
  index: 0,
6714
6715
  iframeWidth: '100%',
6715
6716
  iframeHeight: '100%',
6717
+ iframeMaxWidth: '100%',
6718
+ iframeMaxHeight: '100%',
6716
6719
  download: true,
6717
6720
  counter: true,
6718
6721
  appendCounterTo: '.lg-toolbar',
@@ -7607,8 +7610,14 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7607
7610
  }, {
7608
7611
  key: "addSlideVideoInfo",
7609
7612
  value: function addSlideVideoInfo(items) {
7613
+ var _this9 = this;
7614
+
7610
7615
  items.forEach(function (element, index) {
7611
7616
  element.__slideVideoInfo = lg_utils.isVideo(element.src, !!element.video, index);
7617
+
7618
+ if (element.__slideVideoInfo && _this9.settings.loadYouTubePoster && !element.poster && element.__slideVideoInfo.youtube) {
7619
+ element.poster = "//img.youtube.com/vi/".concat(element.__slideVideoInfo.youtube[1], "/maxresdefault.jpg");
7620
+ }
7612
7621
  });
7613
7622
  }
7614
7623
  /**
@@ -7621,7 +7630,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7621
7630
  }, {
7622
7631
  key: "loadContent",
7623
7632
  value: function loadContent(index, rec) {
7624
- var _this9 = this;
7633
+ var _this10 = this;
7625
7634
 
7626
7635
  var currentGalleryItem = this.galleryItems[index];
7627
7636
  var $currentSlide = $LG(this.getSlideItemId(index));
@@ -7664,7 +7673,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7664
7673
  }
7665
7674
 
7666
7675
  if (iframe) {
7667
- var markup = lg_utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, src, currentGalleryItem.iframeTitle);
7676
+ var markup = lg_utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, this.settings.iframeMaxWidth, this.settings.iframeMaxHeight, src, currentGalleryItem.iframeTitle);
7668
7677
  $currentSlide.prepend(markup);
7669
7678
  } else if (poster) {
7670
7679
  var dummyImg = '';
@@ -7724,24 +7733,24 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7724
7733
 
7725
7734
  if (!$currentSlide.hasClass('lg-loaded')) {
7726
7735
  setTimeout(function () {
7727
- if (_this9.getSlideType(currentGalleryItem) === 'image') {
7736
+ if (_this10.getSlideType(currentGalleryItem) === 'image') {
7728
7737
  $currentSlide.find('.lg-img-wrap').append(lg_utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
7729
7738
 
7730
7739
  if (srcset || sources) {
7731
7740
  var _$img = $currentSlide.find('.lg-object');
7732
7741
 
7733
- _this9.initPictureFill(_$img);
7742
+ _this10.initPictureFill(_$img);
7734
7743
  }
7735
7744
  }
7736
7745
 
7737
- if (_this9.getSlideType(currentGalleryItem) === 'image' || _this9.getSlideType(currentGalleryItem) === 'video' && poster) {
7738
- _this9.onLgObjectLoad($currentSlide, index, delay, _speed, true, false); // load remaining slides once the slide is completely loaded
7746
+ if (_this10.getSlideType(currentGalleryItem) === 'image' || _this10.getSlideType(currentGalleryItem) === 'video' && poster) {
7747
+ _this10.onLgObjectLoad($currentSlide, index, delay, _speed, true, false); // load remaining slides once the slide is completely loaded
7739
7748
 
7740
7749
 
7741
- _this9.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
7742
- _this9.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
7750
+ _this10.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
7751
+ _this10.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
7743
7752
  }, function () {
7744
- _this9.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
7753
+ _this10.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
7745
7754
  });
7746
7755
  }
7747
7756
  }, this.settings.startAnimationDuration + 100);
@@ -7769,7 +7778,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7769
7778
  if (rec === true) {
7770
7779
  if (!$currentSlide.hasClass('lg-complete_')) {
7771
7780
  $currentSlide.find('.lg-object').first().on('load.lg error.lg', function () {
7772
- _this9.preload(index);
7781
+ _this10.preload(index);
7773
7782
  });
7774
7783
  } else {
7775
7784
  this.preload(index);
@@ -7787,23 +7796,23 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7787
7796
  }, {
7788
7797
  key: "loadContentOnFirstSlideLoad",
7789
7798
  value: function loadContentOnFirstSlideLoad(index, $currentSlide, speed) {
7790
- var _this10 = this;
7799
+ var _this11 = this;
7791
7800
 
7792
7801
  setTimeout(function () {
7793
7802
  $currentSlide.find('.lg-dummy-img').remove();
7794
7803
  $currentSlide.removeClass('lg-first-slide');
7795
7804
 
7796
- _this10.outer.removeClass('lg-first-slide-loading');
7805
+ _this11.outer.removeClass('lg-first-slide-loading');
7797
7806
 
7798
- _this10.isDummyImageRemoved = true;
7807
+ _this11.isDummyImageRemoved = true;
7799
7808
 
7800
- _this10.preload(index);
7809
+ _this11.preload(index);
7801
7810
  }, speed + 300);
7802
7811
  }
7803
7812
  }, {
7804
7813
  key: "getItemsToBeInsertedToDom",
7805
7814
  value: function getItemsToBeInsertedToDom(index, prevIndex) {
7806
- var _this11 = this;
7815
+ var _this12 = this;
7807
7816
 
7808
7817
  var numberOfItems = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
7809
7818
  var itemsToBeInsertedToDom = []; // Minimum 2 items should be there
@@ -7814,7 +7823,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7814
7823
 
7815
7824
  if (this.galleryItems.length <= 3) {
7816
7825
  this.galleryItems.forEach(function (_element, index) {
7817
- itemsToBeInsertedToDom.push("lg-item-".concat(_this11.lgId, "-").concat(index));
7826
+ itemsToBeInsertedToDom.push("lg-item-".concat(_this12.lgId, "-").concat(index));
7818
7827
  });
7819
7828
  return itemsToBeInsertedToDom;
7820
7829
  }
@@ -7858,12 +7867,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7858
7867
  }, {
7859
7868
  key: "organizeSlideItems",
7860
7869
  value: function organizeSlideItems(index, prevIndex) {
7861
- var _this12 = this;
7870
+ var _this13 = this;
7862
7871
 
7863
7872
  var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, prevIndex, this.settings.numberOfSlideItemsInDom);
7864
7873
  itemsToBeInsertedToDom.forEach(function (item) {
7865
- if (_this12.currentItemsInDom.indexOf(item) === -1) {
7866
- _this12.$inner.append("<div id=\"".concat(item, "\" class=\"lg-item\"></div>"));
7874
+ if (_this13.currentItemsInDom.indexOf(item) === -1) {
7875
+ _this13.$inner.append("<div id=\"".concat(item, "\" class=\"lg-item\"></div>"));
7867
7876
  }
7868
7877
  });
7869
7878
  this.currentItemsInDom.forEach(function (item) {
@@ -7914,7 +7923,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7914
7923
  }, {
7915
7924
  key: "makeSlideAnimation",
7916
7925
  value: function makeSlideAnimation(direction, currentSlideItem, previousSlideItem) {
7917
- var _this13 = this;
7926
+ var _this14 = this;
7918
7927
 
7919
7928
  if (this.lGalleryOn) {
7920
7929
  previousSlideItem.addClass('lg-slide-progress');
@@ -7922,9 +7931,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7922
7931
 
7923
7932
  setTimeout(function () {
7924
7933
  // remove all transitions
7925
- _this13.outer.addClass('lg-no-trans');
7934
+ _this14.outer.addClass('lg-no-trans');
7926
7935
 
7927
- _this13.outer.find('.lg-item').removeClass('lg-prev-slide lg-next-slide');
7936
+ _this14.outer.find('.lg-item').removeClass('lg-prev-slide lg-next-slide');
7928
7937
 
7929
7938
  if (direction === 'prev') {
7930
7939
  //prevslide
@@ -7938,11 +7947,11 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7938
7947
 
7939
7948
 
7940
7949
  setTimeout(function () {
7941
- _this13.outer.find('.lg-item').removeClass('lg-current');
7950
+ _this14.outer.find('.lg-item').removeClass('lg-current');
7942
7951
 
7943
7952
  currentSlideItem.addClass('lg-current'); // reset all transitions
7944
7953
 
7945
- _this13.outer.removeClass('lg-no-trans');
7954
+ _this14.outer.removeClass('lg-no-trans');
7946
7955
  }, 50);
7947
7956
  }, this.lGalleryOn ? this.settings.slideDelay : 0);
7948
7957
  }
@@ -7963,7 +7972,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7963
7972
  }, {
7964
7973
  key: "slide",
7965
7974
  value: function slide(index, fromTouch, fromThumb, direction) {
7966
- var _this14 = this;
7975
+ var _this15 = this;
7967
7976
 
7968
7977
  var prevIndex = this.getPreviousSlideIndex();
7969
7978
  this.currentItemsInDom = this.organizeSlideItems(index, prevIndex); // Prevent multiple call, Required for hsh plugin
@@ -8051,20 +8060,20 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8051
8060
  this.loadContent(index, true);
8052
8061
  } else {
8053
8062
  setTimeout(function () {
8054
- _this14.loadContent(index, true); // Add title if this.settings.appendSubHtmlTo === lg-sub-html
8063
+ _this15.loadContent(index, true); // Add title if this.settings.appendSubHtmlTo === lg-sub-html
8055
8064
 
8056
8065
 
8057
- if (_this14.settings.appendSubHtmlTo !== '.lg-item') {
8058
- _this14.addHtml(index);
8066
+ if (_this15.settings.appendSubHtmlTo !== '.lg-item') {
8067
+ _this15.addHtml(index);
8059
8068
  }
8060
8069
  }, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
8061
8070
  }
8062
8071
 
8063
8072
  setTimeout(function () {
8064
- _this14.lgBusy = false;
8073
+ _this15.lgBusy = false;
8065
8074
  previousSlideItem.removeClass('lg-slide-progress');
8066
8075
 
8067
- _this14.LGel.trigger(lGEvents.afterSlide, {
8076
+ _this15.LGel.trigger(lGEvents.afterSlide, {
8068
8077
  prevIndex: prevIndex,
8069
8078
  index: index,
8070
8079
  fromTouch: fromTouch,
@@ -8151,7 +8160,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8151
8160
  }, {
8152
8161
  key: "touchEnd",
8153
8162
  value: function touchEnd(endCoords, startCoords, event) {
8154
- var _this15 = this;
8163
+ var _this16 = this;
8155
8164
 
8156
8165
  var distance; // keep slide animation for any mode while dragg/swipe
8157
8166
 
@@ -8161,61 +8170,61 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8161
8170
 
8162
8171
 
8163
8172
  setTimeout(function () {
8164
- _this15.$container.removeClass('lg-dragging-vertical');
8173
+ _this16.$container.removeClass('lg-dragging-vertical');
8165
8174
 
8166
- _this15.outer.removeClass('lg-dragging lg-hide-items').addClass('lg-components-open');
8175
+ _this16.outer.removeClass('lg-dragging lg-hide-items').addClass('lg-components-open');
8167
8176
 
8168
8177
  var triggerClick = true;
8169
8178
 
8170
- if (_this15.swipeDirection === 'horizontal') {
8179
+ if (_this16.swipeDirection === 'horizontal') {
8171
8180
  distance = endCoords.pageX - startCoords.pageX;
8172
8181
  var distanceAbs = Math.abs(endCoords.pageX - startCoords.pageX);
8173
8182
 
8174
- if (distance < 0 && distanceAbs > _this15.settings.swipeThreshold) {
8175
- _this15.goToNextSlide(true);
8183
+ if (distance < 0 && distanceAbs > _this16.settings.swipeThreshold) {
8184
+ _this16.goToNextSlide(true);
8176
8185
 
8177
8186
  triggerClick = false;
8178
- } else if (distance > 0 && distanceAbs > _this15.settings.swipeThreshold) {
8179
- _this15.goToPrevSlide(true);
8187
+ } else if (distance > 0 && distanceAbs > _this16.settings.swipeThreshold) {
8188
+ _this16.goToPrevSlide(true);
8180
8189
 
8181
8190
  triggerClick = false;
8182
8191
  }
8183
- } else if (_this15.swipeDirection === 'vertical') {
8192
+ } else if (_this16.swipeDirection === 'vertical') {
8184
8193
  distance = Math.abs(endCoords.pageY - startCoords.pageY);
8185
8194
 
8186
- if (_this15.settings.closable && _this15.settings.swipeToClose && distance > 100) {
8187
- _this15.closeGallery();
8195
+ if (_this16.settings.closable && _this16.settings.swipeToClose && distance > 100) {
8196
+ _this16.closeGallery();
8188
8197
 
8189
8198
  return;
8190
8199
  } else {
8191
- _this15.$backdrop.css('opacity', 1);
8200
+ _this16.$backdrop.css('opacity', 1);
8192
8201
  }
8193
8202
  }
8194
8203
 
8195
- _this15.outer.find('.lg-item').removeAttr('style');
8204
+ _this16.outer.find('.lg-item').removeAttr('style');
8196
8205
 
8197
8206
  if (triggerClick && Math.abs(endCoords.pageX - startCoords.pageX) < 5) {
8198
8207
  // Trigger click if distance is less than 5 pix
8199
8208
  var target = $LG(event.target);
8200
8209
 
8201
- if (_this15.isPosterElement(target)) {
8202
- _this15.LGel.trigger(lGEvents.posterClick);
8210
+ if (_this16.isPosterElement(target)) {
8211
+ _this16.LGel.trigger(lGEvents.posterClick);
8203
8212
  }
8204
8213
  }
8205
8214
 
8206
- _this15.swipeDirection = undefined;
8215
+ _this16.swipeDirection = undefined;
8207
8216
  }); // remove slide class once drag/swipe is completed if mode is not slide
8208
8217
 
8209
8218
  setTimeout(function () {
8210
- if (!_this15.outer.hasClass('lg-dragging') && _this15.settings.mode !== 'lg-slide') {
8211
- _this15.outer.removeClass('lg-slide');
8219
+ if (!_this16.outer.hasClass('lg-dragging') && _this16.settings.mode !== 'lg-slide') {
8220
+ _this16.outer.removeClass('lg-slide');
8212
8221
  }
8213
8222
  }, this.settings.speed + 100);
8214
8223
  }
8215
8224
  }, {
8216
8225
  key: "enableSwipe",
8217
8226
  value: function enableSwipe() {
8218
- var _this16 = this;
8227
+ var _this17 = this;
8219
8228
 
8220
8229
  var startCoords = {};
8221
8230
  var endCoords = {};
@@ -8224,15 +8233,15 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8224
8233
 
8225
8234
  if (this.settings.enableSwipe) {
8226
8235
  this.$inner.on('touchstart.lg', function (e) {
8227
- _this16.dragOrSwipeEnabled = true;
8236
+ _this17.dragOrSwipeEnabled = true;
8228
8237
 
8229
- var $item = _this16.getSlideItem(_this16.index);
8238
+ var $item = _this17.getSlideItem(_this17.index);
8230
8239
 
8231
- if (($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) && !_this16.outer.hasClass('lg-zoomed') && !_this16.lgBusy && e.targetTouches.length === 1) {
8240
+ if (($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) && !_this17.outer.hasClass('lg-zoomed') && !_this17.lgBusy && e.targetTouches.length === 1) {
8232
8241
  isSwiping = true;
8233
- _this16.touchAction = 'swipe';
8242
+ _this17.touchAction = 'swipe';
8234
8243
 
8235
- _this16.manageSwipeClass();
8244
+ _this17.manageSwipeClass();
8236
8245
 
8237
8246
  startCoords = {
8238
8247
  pageX: e.targetTouches[0].pageX,
@@ -8241,32 +8250,32 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8241
8250
  }
8242
8251
  });
8243
8252
  this.$inner.on('touchmove.lg', function (e) {
8244
- if (isSwiping && _this16.touchAction === 'swipe' && e.targetTouches.length === 1) {
8253
+ if (isSwiping && _this17.touchAction === 'swipe' && e.targetTouches.length === 1) {
8245
8254
  endCoords = {
8246
8255
  pageX: e.targetTouches[0].pageX,
8247
8256
  pageY: e.targetTouches[0].pageY
8248
8257
  };
8249
8258
 
8250
- _this16.touchMove(startCoords, endCoords, e);
8259
+ _this17.touchMove(startCoords, endCoords, e);
8251
8260
 
8252
8261
  isMoved = true;
8253
8262
  }
8254
8263
  });
8255
8264
  this.$inner.on('touchend.lg', function (event) {
8256
- if (_this16.touchAction === 'swipe') {
8265
+ if (_this17.touchAction === 'swipe') {
8257
8266
  if (isMoved) {
8258
8267
  isMoved = false;
8259
8268
 
8260
- _this16.touchEnd(endCoords, startCoords, event);
8269
+ _this17.touchEnd(endCoords, startCoords, event);
8261
8270
  } else if (isSwiping) {
8262
8271
  var target = $LG(event.target);
8263
8272
 
8264
- if (_this16.isPosterElement(target)) {
8265
- _this16.LGel.trigger(lGEvents.posterClick);
8273
+ if (_this17.isPosterElement(target)) {
8274
+ _this17.LGel.trigger(lGEvents.posterClick);
8266
8275
  }
8267
8276
  }
8268
8277
 
8269
- _this16.touchAction = undefined;
8278
+ _this17.touchAction = undefined;
8270
8279
  isSwiping = false;
8271
8280
  }
8272
8281
  });
@@ -8275,7 +8284,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8275
8284
  }, {
8276
8285
  key: "enableDrag",
8277
8286
  value: function enableDrag() {
8278
- var _this17 = this;
8287
+ var _this18 = this;
8279
8288
 
8280
8289
  var startCoords = {};
8281
8290
  var endCoords = {};
@@ -8284,16 +8293,16 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8284
8293
 
8285
8294
  if (this.settings.enableDrag) {
8286
8295
  this.outer.on('mousedown.lg', function (e) {
8287
- _this17.dragOrSwipeEnabled = true;
8296
+ _this18.dragOrSwipeEnabled = true;
8288
8297
 
8289
- var $item = _this17.getSlideItem(_this17.index);
8298
+ var $item = _this18.getSlideItem(_this18.index);
8290
8299
 
8291
8300
  if ($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) {
8292
- if (!_this17.outer.hasClass('lg-zoomed') && !_this17.lgBusy) {
8301
+ if (!_this18.outer.hasClass('lg-zoomed') && !_this18.lgBusy) {
8293
8302
  e.preventDefault();
8294
8303
 
8295
- if (!_this17.lgBusy) {
8296
- _this17.manageSwipeClass();
8304
+ if (!_this18.lgBusy) {
8305
+ _this18.manageSwipeClass();
8297
8306
 
8298
8307
  startCoords = {
8299
8308
  pageX: e.pageX,
@@ -8301,31 +8310,31 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8301
8310
  };
8302
8311
  isDraging = true; // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
8303
8312
 
8304
- _this17.outer.get().scrollLeft += 1;
8305
- _this17.outer.get().scrollLeft -= 1; // *
8313
+ _this18.outer.get().scrollLeft += 1;
8314
+ _this18.outer.get().scrollLeft -= 1; // *
8306
8315
 
8307
- _this17.outer.removeClass('lg-grab').addClass('lg-grabbing');
8316
+ _this18.outer.removeClass('lg-grab').addClass('lg-grabbing');
8308
8317
 
8309
- _this17.LGel.trigger(lGEvents.dragStart);
8318
+ _this18.LGel.trigger(lGEvents.dragStart);
8310
8319
  }
8311
8320
  }
8312
8321
  }
8313
8322
  });
8314
8323
  $LG(window).on("mousemove.lg.global".concat(this.lgId), function (e) {
8315
- if (isDraging && _this17.lgOpened) {
8324
+ if (isDraging && _this18.lgOpened) {
8316
8325
  isMoved = true;
8317
8326
  endCoords = {
8318
8327
  pageX: e.pageX,
8319
8328
  pageY: e.pageY
8320
8329
  };
8321
8330
 
8322
- _this17.touchMove(startCoords, endCoords);
8331
+ _this18.touchMove(startCoords, endCoords);
8323
8332
 
8324
- _this17.LGel.trigger(lGEvents.dragMove);
8333
+ _this18.LGel.trigger(lGEvents.dragMove);
8325
8334
  }
8326
8335
  });
8327
8336
  $LG(window).on("mouseup.lg.global".concat(this.lgId), function (event) {
8328
- if (!_this17.lgOpened) {
8337
+ if (!_this18.lgOpened) {
8329
8338
  return;
8330
8339
  }
8331
8340
 
@@ -8334,18 +8343,18 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8334
8343
  if (isMoved) {
8335
8344
  isMoved = false;
8336
8345
 
8337
- _this17.touchEnd(endCoords, startCoords, event);
8346
+ _this18.touchEnd(endCoords, startCoords, event);
8338
8347
 
8339
- _this17.LGel.trigger(lGEvents.dragEnd);
8340
- } else if (_this17.isPosterElement(target)) {
8341
- _this17.LGel.trigger(lGEvents.posterClick);
8348
+ _this18.LGel.trigger(lGEvents.dragEnd);
8349
+ } else if (_this18.isPosterElement(target)) {
8350
+ _this18.LGel.trigger(lGEvents.posterClick);
8342
8351
  } // Prevent execution on click
8343
8352
 
8344
8353
 
8345
8354
  if (isDraging) {
8346
8355
  isDraging = false;
8347
8356
 
8348
- _this17.outer.removeClass('lg-grabbing').addClass('lg-grab');
8357
+ _this18.outer.removeClass('lg-grabbing').addClass('lg-grab');
8349
8358
  }
8350
8359
  });
8351
8360
  }
@@ -8353,11 +8362,11 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8353
8362
  }, {
8354
8363
  key: "triggerPosterClick",
8355
8364
  value: function triggerPosterClick() {
8356
- var _this18 = this;
8365
+ var _this19 = this;
8357
8366
 
8358
8367
  this.$inner.on('click.lg', function (event) {
8359
- if (!_this18.dragOrSwipeEnabled && _this18.isPosterElement($LG(event.target))) {
8360
- _this18.LGel.trigger(lGEvents.posterClick);
8368
+ if (!_this19.dragOrSwipeEnabled && _this19.isPosterElement($LG(event.target))) {
8369
+ _this19.LGel.trigger(lGEvents.posterClick);
8361
8370
  }
8362
8371
  });
8363
8372
  }
@@ -8397,7 +8406,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8397
8406
  }, {
8398
8407
  key: "goToNextSlide",
8399
8408
  value: function goToNextSlide(fromTouch) {
8400
- var _this19 = this;
8409
+ var _this20 = this;
8401
8410
 
8402
8411
  var _loop = this.settings.loop;
8403
8412
 
@@ -8422,7 +8431,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8422
8431
  } else if (this.settings.slideEndAnimation && !fromTouch) {
8423
8432
  this.outer.addClass('lg-right-end');
8424
8433
  setTimeout(function () {
8425
- _this19.outer.removeClass('lg-right-end');
8434
+ _this20.outer.removeClass('lg-right-end');
8426
8435
  }, 400);
8427
8436
  }
8428
8437
  }
@@ -8442,7 +8451,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8442
8451
  }, {
8443
8452
  key: "goToPrevSlide",
8444
8453
  value: function goToPrevSlide(fromTouch) {
8445
- var _this20 = this;
8454
+ var _this21 = this;
8446
8455
 
8447
8456
  var _loop = this.settings.loop;
8448
8457
 
@@ -8469,7 +8478,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8469
8478
  } else if (this.settings.slideEndAnimation && !fromTouch) {
8470
8479
  this.outer.addClass('lg-left-end');
8471
8480
  setTimeout(function () {
8472
- _this20.outer.removeClass('lg-left-end');
8481
+ _this21.outer.removeClass('lg-left-end');
8473
8482
  }, 400);
8474
8483
  }
8475
8484
  }
@@ -8478,30 +8487,30 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8478
8487
  }, {
8479
8488
  key: "keyPress",
8480
8489
  value: function keyPress() {
8481
- var _this21 = this;
8490
+ var _this22 = this;
8482
8491
 
8483
8492
  $LG(window).on("keydown.lg.global".concat(this.lgId), function (e) {
8484
- if (_this21.lgOpened && _this21.settings.escKey === true && e.keyCode === 27) {
8493
+ if (_this22.lgOpened && _this22.settings.escKey === true && e.keyCode === 27) {
8485
8494
  e.preventDefault();
8486
8495
 
8487
- if (_this21.settings.allowMediaOverlap && _this21.outer.hasClass('lg-can-toggle') && _this21.outer.hasClass('lg-components-open')) {
8488
- _this21.outer.removeClass('lg-components-open');
8496
+ if (_this22.settings.allowMediaOverlap && _this22.outer.hasClass('lg-can-toggle') && _this22.outer.hasClass('lg-components-open')) {
8497
+ _this22.outer.removeClass('lg-components-open');
8489
8498
  } else {
8490
- _this21.closeGallery();
8499
+ _this22.closeGallery();
8491
8500
  }
8492
8501
  }
8493
8502
 
8494
- if (_this21.lgOpened && _this21.galleryItems.length > 1) {
8503
+ if (_this22.lgOpened && _this22.galleryItems.length > 1) {
8495
8504
  if (e.keyCode === 37) {
8496
8505
  e.preventDefault();
8497
8506
 
8498
- _this21.goToPrevSlide();
8507
+ _this22.goToPrevSlide();
8499
8508
  }
8500
8509
 
8501
8510
  if (e.keyCode === 39) {
8502
8511
  e.preventDefault();
8503
8512
 
8504
- _this21.goToNextSlide();
8513
+ _this22.goToNextSlide();
8505
8514
  }
8506
8515
  }
8507
8516
  });
@@ -8509,13 +8518,13 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8509
8518
  }, {
8510
8519
  key: "arrow",
8511
8520
  value: function arrow() {
8512
- var _this22 = this;
8521
+ var _this23 = this;
8513
8522
 
8514
8523
  this.getElementById('lg-prev').on('click.lg', function () {
8515
- _this22.goToPrevSlide();
8524
+ _this23.goToPrevSlide();
8516
8525
  });
8517
8526
  this.getElementById('lg-next').on('click.lg', function () {
8518
- _this22.goToNextSlide();
8527
+ _this23.goToNextSlide();
8519
8528
  });
8520
8529
  }
8521
8530
  }, {
@@ -8549,21 +8558,27 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8549
8558
  }, {
8550
8559
  key: "mousewheel",
8551
8560
  value: function mousewheel() {
8552
- var _this23 = this;
8561
+ var _this24 = this;
8553
8562
 
8554
- this.outer.on('mousewheel.lg', function (e) {
8555
- if (!e.deltaY || _this23.galleryItems.length < 2) {
8563
+ var lastCall = 0;
8564
+ this.outer.on('wheel.lg', function (e) {
8565
+ if (!e.deltaY || _this24.galleryItems.length < 2) {
8556
8566
  return;
8557
8567
  }
8558
8568
 
8559
- if (e.deltaY > 0) {
8560
- _this23.goToNextSlide();
8569
+ e.preventDefault();
8570
+ var now = new Date().getTime();
8561
8571
 
8562
- e.preventDefault();
8563
- } else if (e.deltaY < 0) {
8564
- _this23.goToPrevSlide();
8572
+ if (now - lastCall < 1000) {
8573
+ return;
8574
+ }
8565
8575
 
8566
- e.preventDefault();
8576
+ lastCall = now;
8577
+
8578
+ if (e.deltaY > 0) {
8579
+ _this24.goToNextSlide();
8580
+ } else if (e.deltaY < 0) {
8581
+ _this24.goToPrevSlide();
8567
8582
  }
8568
8583
  });
8569
8584
  }
@@ -8586,12 +8601,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8586
8601
  }, {
8587
8602
  key: "toggleMaximize",
8588
8603
  value: function toggleMaximize() {
8589
- var _this24 = this;
8604
+ var _this25 = this;
8590
8605
 
8591
8606
  this.getElementById('lg-maximize').on('click.lg', function () {
8592
- _this24.$container.toggleClass('lg-inline');
8607
+ _this25.$container.toggleClass('lg-inline');
8593
8608
 
8594
- _this24.refreshOnResize();
8609
+ _this25.refreshOnResize();
8595
8610
  });
8596
8611
  }
8597
8612
  }, {
@@ -8606,12 +8621,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8606
8621
  }, {
8607
8622
  key: "manageCloseGallery",
8608
8623
  value: function manageCloseGallery() {
8609
- var _this25 = this;
8624
+ var _this26 = this;
8610
8625
 
8611
8626
  if (!this.settings.closable) return;
8612
8627
  var mousedown = false;
8613
8628
  this.getElementById('lg-close').on('click.lg', function () {
8614
- _this25.closeGallery();
8629
+ _this26.closeGallery();
8615
8630
  });
8616
8631
 
8617
8632
  if (this.settings.closeOnTap) {
@@ -8620,7 +8635,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8620
8635
  this.outer.on('mousedown.lg', function (e) {
8621
8636
  var target = $LG(e.target);
8622
8637
 
8623
- if (_this25.isSlideElement(target)) {
8638
+ if (_this26.isSlideElement(target)) {
8624
8639
  mousedown = true;
8625
8640
  } else {
8626
8641
  mousedown = false;
@@ -8632,9 +8647,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8632
8647
  this.outer.on('mouseup.lg', function (e) {
8633
8648
  var target = $LG(e.target);
8634
8649
 
8635
- if (_this25.isSlideElement(target) && mousedown) {
8636
- if (!_this25.outer.hasClass('lg-dragging')) {
8637
- _this25.closeGallery();
8650
+ if (_this26.isSlideElement(target) && mousedown) {
8651
+ if (!_this26.outer.hasClass('lg-dragging')) {
8652
+ _this26.closeGallery();
8638
8653
  }
8639
8654
  }
8640
8655
  });
@@ -8655,7 +8670,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8655
8670
  }, {
8656
8671
  key: "closeGallery",
8657
8672
  value: function closeGallery(force) {
8658
- var _this26 = this;
8673
+ var _this27 = this;
8659
8674
 
8660
8675
  if (!this.lgOpened || !this.settings.closable && !force) {
8661
8676
  return 0;
@@ -8704,32 +8719,32 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8704
8719
  this.$container.removeClass('lg-show-in'); // Once the closign animation is completed and gallery is invisible
8705
8720
 
8706
8721
  setTimeout(function () {
8707
- if (_this26.zoomFromOrigin && transform) {
8708
- _this26.outer.removeClass('lg-zoom-from-image');
8722
+ if (_this27.zoomFromOrigin && transform) {
8723
+ _this27.outer.removeClass('lg-zoom-from-image');
8709
8724
  }
8710
8725
 
8711
- _this26.$container.removeClass('lg-show'); // Need to remove inline opacity as it is used in the stylesheet as well
8726
+ _this27.$container.removeClass('lg-show'); // Need to remove inline opacity as it is used in the stylesheet as well
8712
8727
 
8713
8728
 
8714
- _this26.$backdrop.removeAttr('style').css('transition-duration', _this26.settings.backdropDuration + 'ms');
8729
+ _this27.$backdrop.removeAttr('style').css('transition-duration', _this27.settings.backdropDuration + 'ms');
8715
8730
 
8716
- _this26.outer.removeClass("lg-closing ".concat(_this26.settings.startClass));
8731
+ _this27.outer.removeClass("lg-closing ".concat(_this27.settings.startClass));
8717
8732
 
8718
- _this26.getSlideItem(_this26.index).removeClass('lg-start-end-progress');
8733
+ _this27.getSlideItem(_this27.index).removeClass('lg-start-end-progress');
8719
8734
 
8720
- _this26.$inner.empty();
8735
+ _this27.$inner.empty();
8721
8736
 
8722
- if (_this26.lgOpened) {
8723
- _this26.LGel.trigger(lGEvents.afterClose, {
8724
- instance: _this26
8737
+ if (_this27.lgOpened) {
8738
+ _this27.LGel.trigger(lGEvents.afterClose, {
8739
+ instance: _this27
8725
8740
  });
8726
8741
  }
8727
8742
 
8728
- if (_this26.outer.get()) {
8729
- _this26.outer.get().blur();
8743
+ if (_this27.outer.get()) {
8744
+ _this27.outer.get().blur();
8730
8745
  }
8731
8746
 
8732
- _this26.lgOpened = false;
8747
+ _this27.lgOpened = false;
8733
8748
  }, removeTimeout + 100);
8734
8749
  return removeTimeout + 100;
8735
8750
  }
@@ -8815,21 +8830,21 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8815
8830
  }, {
8816
8831
  key: "destroy",
8817
8832
  value: function destroy() {
8818
- var _this27 = this;
8833
+ var _this28 = this;
8819
8834
 
8820
8835
  var closeTimeout = this.closeGallery(true);
8821
8836
  setTimeout(function () {
8822
- _this27.destroyModules(true);
8837
+ _this28.destroyModules(true);
8823
8838
 
8824
- if (!_this27.settings.dynamic) {
8825
- _this27.invalidateItems();
8839
+ if (!_this28.settings.dynamic) {
8840
+ _this28.invalidateItems();
8826
8841
  }
8827
8842
 
8828
- $LG(window).off(".lg.global".concat(_this27.lgId));
8843
+ $LG(window).off(".lg.global".concat(_this28.lgId));
8829
8844
 
8830
- _this27.LGel.off('.lg');
8845
+ _this28.LGel.off('.lg');
8831
8846
 
8832
- _this27.$container.remove();
8847
+ _this28.$container.remove();
8833
8848
  }, closeTimeout);
8834
8849
  return closeTimeout;
8835
8850
  }