lightgallery 2.3.0-beta → 2.3.0-beta.4

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 (104) hide show
  1. package/css/lightgallery-bundle.css +19 -26
  2. package/css/lightgallery-bundle.min.css +1 -1
  3. package/css/lightgallery-core.css +0 -19
  4. package/css/lightgallery.css +19 -26
  5. package/lg-events.d.ts +0 -4
  6. package/lg-settings.d.ts +4 -7
  7. package/lg-utils.d.ts +10 -1
  8. package/lib/lg-settings.js +1 -2
  9. package/lib/lg-settings.js.map +1 -1
  10. package/lib/lg-utils.js +43 -3
  11. package/lib/lg-utils.js.map +1 -1
  12. package/lib/lgQuery.js +31 -20
  13. package/lib/lgQuery.js.map +1 -1
  14. package/lib/lightgallery.js +100 -118
  15. package/lib/lightgallery.js.map +1 -1
  16. package/lib/plugins/video/lg-video-settings.js.map +1 -1
  17. package/lib/plugins/video/lg-video-utils.js +24 -0
  18. package/lib/plugins/video/lg-video-utils.js.map +1 -0
  19. package/lib/plugins/video/lg-video.js +38 -30
  20. package/lib/plugins/video/lg-video.js.map +1 -1
  21. package/lib/plugins/zoom/lg-zoom.js +7 -8
  22. package/lib/plugins/zoom/lg-zoom.js.map +1 -1
  23. package/lightgallery.d.ts +18 -10
  24. package/lightgallery.es5.js +176 -144
  25. package/lightgallery.es5.js.map +1 -1
  26. package/lightgallery.min.js +2 -2
  27. package/lightgallery.umd.js +176 -144
  28. package/lightgallery.umd.js.map +1 -1
  29. package/lit/lightgallery.esm.js +7 -7
  30. package/lit/lightgallery.umd.js +3 -3
  31. package/package.json +1 -1
  32. package/plugins/autoplay/lg-autoplay.es5.js +1 -1
  33. package/plugins/autoplay/lg-autoplay.es5.js.map +1 -1
  34. package/plugins/autoplay/lg-autoplay.min.js +1 -1
  35. package/plugins/autoplay/lg-autoplay.umd.js +1 -1
  36. package/plugins/autoplay/lg-autoplay.umd.js.map +1 -1
  37. package/plugins/comment/lg-comment.es5.js +1 -1
  38. package/plugins/comment/lg-comment.es5.js.map +1 -1
  39. package/plugins/comment/lg-comment.min.js +1 -1
  40. package/plugins/comment/lg-comment.umd.js +1 -1
  41. package/plugins/comment/lg-comment.umd.js.map +1 -1
  42. package/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
  43. package/plugins/fullscreen/lg-fullscreen.min.js +1 -1
  44. package/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
  45. package/plugins/hash/lg-hash.es5.js +1 -1
  46. package/plugins/hash/lg-hash.es5.js.map +1 -1
  47. package/plugins/hash/lg-hash.min.js +1 -1
  48. package/plugins/hash/lg-hash.umd.js +1 -1
  49. package/plugins/hash/lg-hash.umd.js.map +1 -1
  50. package/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
  51. package/plugins/mediumZoom/lg-medium-zoom.es5.js.map +1 -1
  52. package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
  53. package/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
  54. package/plugins/mediumZoom/lg-medium-zoom.umd.js.map +1 -1
  55. package/plugins/pager/lg-pager.es5.js +1 -1
  56. package/plugins/pager/lg-pager.es5.js.map +1 -1
  57. package/plugins/pager/lg-pager.min.js +1 -1
  58. package/plugins/pager/lg-pager.umd.js +1 -1
  59. package/plugins/pager/lg-pager.umd.js.map +1 -1
  60. package/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
  61. package/plugins/relativeCaption/lg-relative-caption.es5.js.map +1 -1
  62. package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
  63. package/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
  64. package/plugins/relativeCaption/lg-relative-caption.umd.js.map +1 -1
  65. package/plugins/rotate/lg-rotate.es5.js +1 -1
  66. package/plugins/rotate/lg-rotate.es5.js.map +1 -1
  67. package/plugins/rotate/lg-rotate.min.js +1 -1
  68. package/plugins/rotate/lg-rotate.umd.js +1 -1
  69. package/plugins/rotate/lg-rotate.umd.js.map +1 -1
  70. package/plugins/share/lg-share.es5.js +1 -1
  71. package/plugins/share/lg-share.es5.js.map +1 -1
  72. package/plugins/share/lg-share.min.js +1 -1
  73. package/plugins/share/lg-share.umd.js +1 -1
  74. package/plugins/share/lg-share.umd.js.map +1 -1
  75. package/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
  76. package/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -1
  77. package/plugins/thumbnail/lg-thumbnail.min.js +1 -1
  78. package/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
  79. package/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -1
  80. package/plugins/video/lg-video-settings.d.ts +2 -1
  81. package/plugins/video/lg-video-utils.d.ts +6 -0
  82. package/plugins/video/lg-video.d.ts +6 -1
  83. package/plugins/video/lg-video.es5.js +57 -29
  84. package/plugins/video/lg-video.es5.js.map +1 -1
  85. package/plugins/video/lg-video.min.js +2 -2
  86. package/plugins/video/lg-video.umd.js +57 -29
  87. package/plugins/video/lg-video.umd.js.map +1 -1
  88. package/plugins/zoom/lg-zoom.es5.js +8 -9
  89. package/plugins/zoom/lg-zoom.es5.js.map +1 -1
  90. package/plugins/zoom/lg-zoom.min.js +2 -2
  91. package/plugins/zoom/lg-zoom.umd.js +8 -9
  92. package/plugins/zoom/lg-zoom.umd.js.map +1 -1
  93. package/react/Lightgallery.es5.js +176 -144
  94. package/react/Lightgallery.es5.js.map +1 -1
  95. package/react/Lightgallery.umd.js +176 -144
  96. package/react/Lightgallery.umd.js.map +1 -1
  97. package/scss/_lg-theme-default.scss +17 -10
  98. package/scss/lightgallery-core.scss +0 -24
  99. package/vue/LightGalleryVue.common.js +291 -268
  100. package/vue/LightGalleryVue.common.js.map +1 -1
  101. package/vue/LightGalleryVue.umd.js +291 -268
  102. package/vue/LightGalleryVue.umd.js.map +1 -1
  103. package/vue/LightGalleryVue.umd.min.js +2 -2
  104. package/vue/LightGalleryVue.umd.min.js.map +1 -1
@@ -5805,9 +5805,6 @@ var es_array_concat = __webpack_require__("99af");
5805
5805
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
5806
5806
  var es_array_find = __webpack_require__("7db0");
5807
5807
 
5808
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.match.js
5809
- var es_string_match = __webpack_require__("466d");
5810
-
5811
5808
  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
5812
5809
  function arrayLikeToArray_arrayLikeToArray(arr, len) {
5813
5810
  if (len == null || len > arr.length) len = arr.length;
@@ -5895,6 +5892,9 @@ var es_array_map = __webpack_require__("d81d");
5895
5892
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.splice.js
5896
5893
  var es_array_splice = __webpack_require__("a434");
5897
5894
 
5895
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.match.js
5896
+ var es_string_match = __webpack_require__("466d");
5897
+
5898
5898
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
5899
5899
  var es_promise = __webpack_require__("e6cf");
5900
5900
 
@@ -5915,28 +5915,30 @@ var es_regexp_to_string = __webpack_require__("25f0");
5915
5915
 
5916
5916
 
5917
5917
 
5918
- (function () {
5919
- if (typeof window.CustomEvent === 'function') return false;
5918
+ function initLgPolyfills() {
5919
+ (function () {
5920
+ if (typeof window.CustomEvent === 'function') return false;
5920
5921
 
5921
- function CustomEvent(event, params) {
5922
- params = params || {
5923
- bubbles: false,
5924
- cancelable: false,
5925
- detail: null
5926
- };
5927
- var evt = document.createEvent('CustomEvent');
5928
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
5929
- return evt;
5930
- }
5922
+ function CustomEvent(event, params) {
5923
+ params = params || {
5924
+ bubbles: false,
5925
+ cancelable: false,
5926
+ detail: null
5927
+ };
5928
+ var evt = document.createEvent('CustomEvent');
5929
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
5930
+ return evt;
5931
+ }
5931
5932
 
5932
- window.CustomEvent = CustomEvent;
5933
- })();
5933
+ window.CustomEvent = CustomEvent;
5934
+ })();
5934
5935
 
5935
- (function () {
5936
- if (!Element.prototype.matches) {
5937
- Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
5938
- }
5939
- })();
5936
+ (function () {
5937
+ if (!Element.prototype.matches) {
5938
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
5939
+ }
5940
+ })();
5941
+ }
5940
5942
 
5941
5943
  var lgQuery_lgQuery = /*#__PURE__*/function () {
5942
5944
  function lgQuery(selector) {
@@ -6099,7 +6101,9 @@ var lgQuery_lgQuery = /*#__PURE__*/function () {
6099
6101
  this._each(function (el) {
6100
6102
  // IE doesn't support multiple arguments
6101
6103
  classNames.split(' ').forEach(function (className) {
6102
- el.classList.add(className);
6104
+ if (className) {
6105
+ el.classList.add(className);
6106
+ }
6103
6107
  });
6104
6108
  });
6105
6109
 
@@ -6111,7 +6115,9 @@ var lgQuery_lgQuery = /*#__PURE__*/function () {
6111
6115
  this._each(function (el) {
6112
6116
  // IE doesn't support multiple arguments
6113
6117
  classNames.split(' ').forEach(function (className) {
6114
- el.classList.remove(className);
6118
+ if (className) {
6119
+ el.classList.remove(className);
6120
+ }
6115
6121
  });
6116
6122
  });
6117
6123
 
@@ -6373,6 +6379,7 @@ var lgQuery_lgQuery = /*#__PURE__*/function () {
6373
6379
  }();
6374
6380
  lgQuery_lgQuery.eventListeners = {};
6375
6381
  function $LG(selector) {
6382
+ initLgPolyfills();
6376
6383
  return new lgQuery_lgQuery(selector);
6377
6384
  }
6378
6385
  // CONCATENATED MODULE: ../src/lg-utils.ts
@@ -6389,6 +6396,7 @@ function $LG(selector) {
6389
6396
 
6390
6397
 
6391
6398
 
6399
+
6392
6400
  var defaultDynamicOptions = ['src', 'sources', 'subHtml', 'subHtmlUrl', 'html', 'video', 'poster', 'slideName', 'responsive', 'srcset', 'sizes', 'iframe', 'downloadUrl', 'download', 'width', 'facebookShareUrl', 'tweetText', 'iframeTitle', 'twitterShareUrl', 'pinterestShareUrl', 'pinterestText', 'fbHtml', 'disqusIdentifier', 'disqusUrl']; // Convert html data-attribute to camalcase
6393
6401
 
6394
6402
  function convertToData(attr) {
@@ -6408,15 +6416,13 @@ var utils = {
6408
6416
  /**
6409
6417
  * get possible width and height from the lgSize attribute. Used for ZoomFromOrigin option
6410
6418
  */
6411
- // @todo improive this
6412
6419
  getSize: function getSize(el, container) {
6413
6420
  var spacing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
6414
- var isDisabled = arguments.length > 3 ? arguments[3] : undefined;
6415
- var defaultLgSize = arguments.length > 4 ? arguments[4] : undefined;
6421
+ var defaultLgSize = arguments.length > 3 ? arguments[3] : undefined;
6416
6422
  var LGel = $LG(el);
6417
6423
  var lgSize = LGel.attr('data-lg-size') || defaultLgSize;
6418
6424
 
6419
- if (!lgSize || isDisabled) {
6425
+ if (!lgSize) {
6420
6426
  return;
6421
6427
  }
6422
6428
 
@@ -6618,6 +6624,45 @@ var utils = {
6618
6624
  },
6619
6625
  isMobile: function isMobile() {
6620
6626
  return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
6627
+ },
6628
+
6629
+ /**
6630
+ * @desc Check the given src is video
6631
+ * @param {String} src
6632
+ * @return {Object} video type
6633
+ * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
6634
+ *
6635
+ * @todo - this information can be moved to dynamicEl to avoid frequent calls
6636
+ */
6637
+ isVideo: function isVideo(src, isHTML5VIdeo, index) {
6638
+ if (!src) {
6639
+ if (isHTML5VIdeo) {
6640
+ return {
6641
+ html5: true
6642
+ };
6643
+ } else {
6644
+ console.error('lightGallery :- data-src is not provided on slide item ' + (index + 1) + '. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
6645
+ return;
6646
+ }
6647
+ }
6648
+
6649
+ var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
6650
+ var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)(.*)?/i);
6651
+ var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
6652
+
6653
+ if (youtube) {
6654
+ return {
6655
+ youtube: youtube
6656
+ };
6657
+ } else if (vimeo) {
6658
+ return {
6659
+ vimeo: vimeo
6660
+ };
6661
+ } else if (wistia) {
6662
+ return {
6663
+ wistia: wistia
6664
+ };
6665
+ }
6621
6666
  }
6622
6667
  };
6623
6668
  /* harmony default export */ var lg_utils = (utils);
@@ -6632,7 +6677,7 @@ var lightGalleryCoreSettings = {
6632
6677
  addClass: '',
6633
6678
  startClass: 'lg-start-zoom',
6634
6679
  backdropDuration: 300,
6635
- container: document.body,
6680
+ container: '',
6636
6681
  startAnimationDuration: 400,
6637
6682
  zoomFromOrigin: true,
6638
6683
  hideBarsDelay: 0,
@@ -6661,7 +6706,6 @@ var lightGalleryCoreSettings = {
6661
6706
  subHtmlSelectorRelative: false,
6662
6707
  preload: 2,
6663
6708
  numberOfSlideItemsInDom: 10,
6664
- showAfterLoad: true,
6665
6709
  selector: '',
6666
6710
  selectWithin: '',
6667
6711
  nextHtml: '',
@@ -6730,7 +6774,6 @@ var lGEvents = {
6730
6774
 
6731
6775
 
6732
6776
 
6733
-
6734
6777
  // @ref - https://stackoverflow.com/questions/3971841/how-to-resize-images-proportionally-keeping-the-aspect-ratio
6735
6778
  // @ref - https://2ality.com/2017/04/setting-up-multi-platform-packages.html
6736
6779
  // Unique id for each gallery
@@ -6980,10 +7023,6 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
6980
7023
  outerClassNames += 'lg-grab ';
6981
7024
  }
6982
7025
 
6983
- if (this.settings.showAfterLoad) {
6984
- outerClassNames += 'lg-show-after-load';
6985
- }
6986
-
6987
7026
  this.outer.addClass(outerClassNames);
6988
7027
  this.$inner.css('transition-timing-function', this.settings.easing);
6989
7028
  this.$inner.css('transition-duration', this.settings.speed + 'ms');
@@ -7006,13 +7045,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7006
7045
  value: function refreshOnResize() {
7007
7046
  if (this.lgOpened) {
7008
7047
  var currentGalleryItem = this.galleryItems[this.index];
7009
- var __slideVideoInfo = currentGalleryItem.__slideVideoInfo,
7010
- poster = currentGalleryItem.poster;
7048
+ var __slideVideoInfo = currentGalleryItem.__slideVideoInfo;
7011
7049
  this.mediaContainerPosition = this.getMediaContainerPosition();
7012
7050
  var _this$mediaContainerP = this.mediaContainerPosition,
7013
7051
  top = _this$mediaContainerP.top,
7014
7052
  bottom = _this$mediaContainerP.bottom;
7015
- this.currentImageSize = lg_utils.getSize(this.items[this.index], this.outer, top + bottom, __slideVideoInfo && !poster, __slideVideoInfo && this.settings.videoMaxSize);
7053
+ this.currentImageSize = lg_utils.getSize(this.items[this.index], this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
7016
7054
 
7017
7055
  if (__slideVideoInfo) {
7018
7056
  this.resizeVideoSlide(this.index, this.currentImageSize);
@@ -7205,12 +7243,10 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7205
7243
  this.setMediaContainerPosition(top, bottom);
7206
7244
  }
7207
7245
 
7208
- var _this$galleryItems$in = this.galleryItems[index],
7209
- __slideVideoInfo = _this$galleryItems$in.__slideVideoInfo,
7210
- poster = _this$galleryItems$in.poster;
7246
+ var __slideVideoInfo = this.galleryItems[index].__slideVideoInfo;
7211
7247
 
7212
7248
  if (this.zoomFromOrigin && element) {
7213
- this.currentImageSize = lg_utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && !poster, __slideVideoInfo && this.settings.videoMaxSize);
7249
+ this.currentImageSize = lg_utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
7214
7250
  transform = lg_utils.getTransform(element, this.outer, top, bottom, this.currentImageSize);
7215
7251
  }
7216
7252
 
@@ -7496,7 +7532,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7496
7532
  var imgContent = '';
7497
7533
  var altAttr = alt ? 'alt="' + alt + '"' : '';
7498
7534
 
7499
- if (!this.lGalleryOn && this.zoomFromOrigin && this.currentImageSize) {
7535
+ if (this.isFirstSlideWithZoomAnimation()) {
7500
7536
  imgContent = this.getDummyImageContent($currentSlide, index, altAttr);
7501
7537
  } else {
7502
7538
  imgContent = lg_utils.getImgMarkup(index, src, altAttr, srcset, sizes, sources);
@@ -7506,94 +7542,73 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7506
7542
  $currentSlide.prepend(imgMarkup);
7507
7543
  }
7508
7544
  }, {
7509
- key: "onLgObjectLoad",
7510
- value: function onLgObjectLoad($el, index, delay, speed, dummyImageLoaded, isFirstSlide) {
7511
- var _this7 = this;
7545
+ key: "onSlideObjectLoad",
7546
+ value: function onSlideObjectLoad($slide, isHTML5VideoWithoutPoster, onLoad, onError) {
7547
+ var mediaObject = $slide.find('.lg-object').first();
7512
7548
 
7513
- if (dummyImageLoaded) {
7514
- this.LGel.trigger(lGEvents.slideItemLoad, {
7515
- index: index,
7516
- delay: delay || 0,
7517
- isFirstSlide: isFirstSlide
7549
+ if (lg_utils.isImageLoaded(mediaObject.get()) || isHTML5VideoWithoutPoster) {
7550
+ onLoad();
7551
+ } else {
7552
+ mediaObject.on('load.lg error.lg', function () {
7553
+ onLoad && onLoad();
7554
+ });
7555
+ mediaObject.on('error.lg', function () {
7556
+ onError && onError();
7518
7557
  });
7519
7558
  }
7559
+ }
7560
+ /**
7561
+ *
7562
+ * @param $el Current slide item
7563
+ * @param index
7564
+ * @param delay Delay is 0 except first time
7565
+ * @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin
7566
+ * @param isFirstSlide
7567
+ */
7568
+
7569
+ }, {
7570
+ key: "onLgObjectLoad",
7571
+ value: function onLgObjectLoad(currentSlide, index, delay, speed, isFirstSlide, isHTML5VideoWithoutPoster) {
7572
+ var _this7 = this;
7520
7573
 
7521
- $el.find('.lg-object').first().on('load.lg', function () {
7522
- _this7.handleLgObjectLoad($el, index, delay, speed, dummyImageLoaded, isFirstSlide);
7574
+ this.onSlideObjectLoad(currentSlide, isHTML5VideoWithoutPoster, function () {
7575
+ _this7.triggerSlideItemLoad(currentSlide, index, delay, speed, isFirstSlide);
7576
+ }, function () {
7577
+ currentSlide.addClass('lg-complete lg-complete_');
7578
+ currentSlide.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
7523
7579
  });
7524
- setTimeout(function () {
7525
- $el.find('.lg-object').first().on('error.lg', function () {
7526
- $el.addClass('lg-complete lg-complete_');
7527
- $el.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
7528
- });
7529
- }, speed);
7530
7580
  }
7531
7581
  }, {
7532
- key: "handleLgObjectLoad",
7533
- value: function handleLgObjectLoad($el, index, delay, speed, dummyImageLoaded, isFirstSlide) {
7582
+ key: "triggerSlideItemLoad",
7583
+ value: function triggerSlideItemLoad($currentSlide, index, delay, speed, isFirstSlide) {
7534
7584
  var _this8 = this;
7535
7585
 
7586
+ var currentGalleryItem = this.galleryItems[index]; // Adding delay for video slides without poster for better performance and user experience
7587
+ // Videos should start playing once once the gallery is completely loaded
7588
+
7589
+ var _speed = isFirstSlide && this.getSlideType(currentGalleryItem) === 'video' && !currentGalleryItem.poster ? speed : 0;
7590
+
7536
7591
  setTimeout(function () {
7537
- $el.addClass('lg-complete lg-complete_');
7592
+ $currentSlide.addClass('lg-complete lg-complete_');
7538
7593
 
7539
- if (!dummyImageLoaded) {
7540
- _this8.LGel.trigger(lGEvents.slideItemLoad, {
7541
- index: index,
7542
- delay: delay || 0,
7543
- isFirstSlide: isFirstSlide
7544
- });
7545
- }
7546
- }, speed);
7594
+ _this8.LGel.trigger(lGEvents.slideItemLoad, {
7595
+ index: index,
7596
+ delay: delay || 0,
7597
+ isFirstSlide: isFirstSlide
7598
+ });
7599
+ }, _speed);
7547
7600
  }
7548
- /**
7549
- * @desc Check the given src is video
7550
- * @param {String} src
7551
- * @return {Object} video type
7552
- * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
7553
- *
7554
- * @todo - this information can be moved to dynamicEl to avoid frequent calls
7555
- */
7556
-
7557
7601
  }, {
7558
- key: "isVideo",
7559
- value: function isVideo(src, index) {
7560
- if (!src) {
7561
- if (this.galleryItems[index].video) {
7562
- return {
7563
- html5: true
7564
- };
7565
- } else {
7566
- console.error('lightGallery :- data-src is not provided on slide item ' + (index + 1) + '. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
7567
- return;
7568
- }
7569
- }
7570
-
7571
- var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
7572
- var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)/i);
7573
- var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
7574
-
7575
- if (youtube) {
7576
- return {
7577
- youtube: youtube
7578
- };
7579
- } else if (vimeo) {
7580
- return {
7581
- vimeo: vimeo
7582
- };
7583
- } else if (wistia) {
7584
- return {
7585
- wistia: wistia
7586
- };
7587
- }
7602
+ key: "isFirstSlideWithZoomAnimation",
7603
+ value: function isFirstSlideWithZoomAnimation() {
7604
+ return !!(!this.lGalleryOn && this.zoomFromOrigin && this.currentImageSize);
7588
7605
  } // Add video slideInfo
7589
7606
 
7590
7607
  }, {
7591
7608
  key: "addSlideVideoInfo",
7592
7609
  value: function addSlideVideoInfo(items) {
7593
- var _this9 = this;
7594
-
7595
7610
  items.forEach(function (element, index) {
7596
- element.__slideVideoInfo = _this9.isVideo(element.src, index);
7611
+ element.__slideVideoInfo = lg_utils.isVideo(element.src, !!element.video, index);
7597
7612
  });
7598
7613
  }
7599
7614
  /**
@@ -7606,7 +7621,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7606
7621
  }, {
7607
7622
  key: "loadContent",
7608
7623
  value: function loadContent(index, rec) {
7609
- var _this10 = this;
7624
+ var _this9 = this;
7610
7625
 
7611
7626
  var currentGalleryItem = this.galleryItems[index];
7612
7627
  var $currentSlide = $LG(this.getSlideItemId(index));
@@ -7644,7 +7659,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7644
7659
  var _this$mediaContainerP3 = this.mediaContainerPosition,
7645
7660
  top = _this$mediaContainerP3.top,
7646
7661
  bottom = _this$mediaContainerP3.bottom;
7647
- var videoSize = lg_utils.getSize(this.items[index], this.outer, top + bottom, false, videoInfo && this.settings.videoMaxSize);
7662
+ var videoSize = lg_utils.getSize(this.items[index], this.outer, top + bottom, videoInfo && this.settings.videoMaxSize);
7648
7663
  lgVideoStyle = this.getVideoContStyle(videoSize);
7649
7664
  }
7650
7665
 
@@ -7680,8 +7695,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7680
7695
  index: index,
7681
7696
  src: src,
7682
7697
  html5Video: _html5Video,
7683
- hasPoster: !!poster,
7684
- isFirstSlide: isFirstSlide
7698
+ hasPoster: !!poster
7685
7699
  });
7686
7700
  }
7687
7701
 
@@ -7700,33 +7714,34 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7700
7714
 
7701
7715
  if (delay && !$LG(document.body).hasClass('lg-from-hash')) {
7702
7716
  _speed = delay;
7703
- } // Only for first slide
7717
+ } // Only for first slide and zoomFromOrigin is enabled
7704
7718
 
7705
7719
 
7706
- if (!this.lGalleryOn && this.zoomFromOrigin && this.currentImageSize) {
7720
+ if (this.isFirstSlideWithZoomAnimation()) {
7707
7721
  setTimeout(function () {
7708
7722
  $currentSlide.removeClass('lg-start-end-progress lg-start-progress').removeAttr('style');
7709
7723
  }, this.settings.startAnimationDuration + 100);
7710
7724
 
7711
7725
  if (!$currentSlide.hasClass('lg-loaded')) {
7712
7726
  setTimeout(function () {
7713
- $currentSlide.find('.lg-img-wrap').append(lg_utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
7727
+ if (_this9.getSlideType(currentGalleryItem) === 'image') {
7728
+ $currentSlide.find('.lg-img-wrap').append(lg_utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
7714
7729
 
7715
- if (srcset || sources) {
7716
- var _$img = $currentSlide.find('.lg-object');
7730
+ if (srcset || sources) {
7731
+ var _$img = $currentSlide.find('.lg-object');
7717
7732
 
7718
- _this10.initPictureFill(_$img);
7733
+ _this9.initPictureFill(_$img);
7734
+ }
7719
7735
  }
7720
7736
 
7721
- _this10.onLgObjectLoad($currentSlide, index, delay, _speed, true, true);
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
7722
7739
 
7723
- var mediaObject = $currentSlide.find('.lg-object').first();
7724
7740
 
7725
- if (lg_utils.isImageLoaded(mediaObject.get())) {
7726
- _this10.loadContentOnLoad(index, $currentSlide, _speed);
7727
- } else {
7728
- mediaObject.on('load.lg error.lg', function () {
7729
- _this10.loadContentOnLoad(index, $currentSlide, _speed);
7741
+ _this9.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
7742
+ _this9.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
7743
+ }, function () {
7744
+ _this9.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
7730
7745
  });
7731
7746
  }
7732
7747
  }, this.settings.startAnimationDuration + 100);
@@ -7735,10 +7750,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7735
7750
 
7736
7751
 
7737
7752
  $currentSlide.addClass('lg-loaded');
7738
- this.onLgObjectLoad($currentSlide, index, delay, _speed, false, isFirstSlide); // @todo check load state for html5 videos
7739
7753
 
7740
- if (videoInfo && videoInfo.html5 && !poster) {
7741
- $currentSlide.addClass('lg-complete lg-complete_');
7754
+ if (!this.isFirstSlideWithZoomAnimation() || this.getSlideType(currentGalleryItem) === 'video' && !poster) {
7755
+ this.onLgObjectLoad($currentSlide, index, delay, _speed, isFirstSlide, !!(videoInfo && videoInfo.html5 && !poster));
7742
7756
  } // When gallery is opened once content is loaded (second time) need to add lg-complete class for css styling
7743
7757
 
7744
7758
 
@@ -7755,33 +7769,41 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7755
7769
  if (rec === true) {
7756
7770
  if (!$currentSlide.hasClass('lg-complete_')) {
7757
7771
  $currentSlide.find('.lg-object').first().on('load.lg error.lg', function () {
7758
- _this10.preload(index);
7772
+ _this9.preload(index);
7759
7773
  });
7760
7774
  } else {
7761
7775
  this.preload(index);
7762
7776
  }
7763
7777
  }
7764
7778
  }
7779
+ /**
7780
+ * @desc Remove dummy image content and load next slides
7781
+ * Called only for the first time if zoomFromOrigin animation is enabled
7782
+ * @param index
7783
+ * @param $currentSlide
7784
+ * @param speed
7785
+ */
7786
+
7765
7787
  }, {
7766
- key: "loadContentOnLoad",
7767
- value: function loadContentOnLoad(index, $currentSlide, speed) {
7768
- var _this11 = this;
7788
+ key: "loadContentOnFirstSlideLoad",
7789
+ value: function loadContentOnFirstSlideLoad(index, $currentSlide, speed) {
7790
+ var _this10 = this;
7769
7791
 
7770
7792
  setTimeout(function () {
7771
7793
  $currentSlide.find('.lg-dummy-img').remove();
7772
7794
  $currentSlide.removeClass('lg-first-slide');
7773
7795
 
7774
- _this11.outer.removeClass('lg-first-slide-loading');
7796
+ _this10.outer.removeClass('lg-first-slide-loading');
7775
7797
 
7776
- _this11.isDummyImageRemoved = true;
7798
+ _this10.isDummyImageRemoved = true;
7777
7799
 
7778
- _this11.preload(index);
7800
+ _this10.preload(index);
7779
7801
  }, speed + 300);
7780
7802
  }
7781
7803
  }, {
7782
7804
  key: "getItemsToBeInsertedToDom",
7783
7805
  value: function getItemsToBeInsertedToDom(index, prevIndex) {
7784
- var _this12 = this;
7806
+ var _this11 = this;
7785
7807
 
7786
7808
  var numberOfItems = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
7787
7809
  var itemsToBeInsertedToDom = []; // Minimum 2 items should be there
@@ -7792,7 +7814,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7792
7814
 
7793
7815
  if (this.galleryItems.length <= 3) {
7794
7816
  this.galleryItems.forEach(function (_element, index) {
7795
- itemsToBeInsertedToDom.push("lg-item-".concat(_this12.lgId, "-").concat(index));
7817
+ itemsToBeInsertedToDom.push("lg-item-".concat(_this11.lgId, "-").concat(index));
7796
7818
  });
7797
7819
  return itemsToBeInsertedToDom;
7798
7820
  }
@@ -7836,12 +7858,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7836
7858
  }, {
7837
7859
  key: "organizeSlideItems",
7838
7860
  value: function organizeSlideItems(index, prevIndex) {
7839
- var _this13 = this;
7861
+ var _this12 = this;
7840
7862
 
7841
7863
  var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, prevIndex, this.settings.numberOfSlideItemsInDom);
7842
7864
  itemsToBeInsertedToDom.forEach(function (item) {
7843
- if (_this13.currentItemsInDom.indexOf(item) === -1) {
7844
- _this13.$inner.append("<div id=\"".concat(item, "\" class=\"lg-item\"></div>"));
7865
+ if (_this12.currentItemsInDom.indexOf(item) === -1) {
7866
+ _this12.$inner.append("<div id=\"".concat(item, "\" class=\"lg-item\"></div>"));
7845
7867
  }
7846
7868
  });
7847
7869
  this.currentItemsInDom.forEach(function (item) {
@@ -7892,7 +7914,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7892
7914
  }, {
7893
7915
  key: "makeSlideAnimation",
7894
7916
  value: function makeSlideAnimation(direction, currentSlideItem, previousSlideItem) {
7895
- var _this14 = this;
7917
+ var _this13 = this;
7896
7918
 
7897
7919
  if (this.lGalleryOn) {
7898
7920
  previousSlideItem.addClass('lg-slide-progress');
@@ -7900,9 +7922,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7900
7922
 
7901
7923
  setTimeout(function () {
7902
7924
  // remove all transitions
7903
- _this14.outer.addClass('lg-no-trans');
7925
+ _this13.outer.addClass('lg-no-trans');
7904
7926
 
7905
- _this14.outer.find('.lg-item').removeClass('lg-prev-slide lg-next-slide');
7927
+ _this13.outer.find('.lg-item').removeClass('lg-prev-slide lg-next-slide');
7906
7928
 
7907
7929
  if (direction === 'prev') {
7908
7930
  //prevslide
@@ -7916,11 +7938,11 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7916
7938
 
7917
7939
 
7918
7940
  setTimeout(function () {
7919
- _this14.outer.find('.lg-item').removeClass('lg-current');
7941
+ _this13.outer.find('.lg-item').removeClass('lg-current');
7920
7942
 
7921
7943
  currentSlideItem.addClass('lg-current'); // reset all transitions
7922
7944
 
7923
- _this14.outer.removeClass('lg-no-trans');
7945
+ _this13.outer.removeClass('lg-no-trans');
7924
7946
  }, 50);
7925
7947
  }, this.lGalleryOn ? this.settings.slideDelay : 0);
7926
7948
  }
@@ -7941,7 +7963,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7941
7963
  }, {
7942
7964
  key: "slide",
7943
7965
  value: function slide(index, fromTouch, fromThumb, direction) {
7944
- var _this15 = this;
7966
+ var _this14 = this;
7945
7967
 
7946
7968
  var prevIndex = this.getPreviousSlideIndex();
7947
7969
  this.currentItemsInDom = this.organizeSlideItems(index, prevIndex); // Prevent multiple call, Required for hsh plugin
@@ -7968,7 +7990,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7968
7990
  var _this$mediaContainerP4 = this.mediaContainerPosition,
7969
7991
  top = _this$mediaContainerP4.top,
7970
7992
  bottom = _this$mediaContainerP4.bottom;
7971
- var videoSize = lg_utils.getSize(this.items[index], this.outer, top + bottom, false, videoInfo && this.settings.videoMaxSize);
7993
+ var videoSize = lg_utils.getSize(this.items[index], this.outer, top + bottom, videoInfo && this.settings.videoMaxSize);
7972
7994
  this.resizeVideoSlide(index, videoSize);
7973
7995
  }
7974
7996
 
@@ -8027,23 +8049,22 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8027
8049
 
8028
8050
  if (!this.lGalleryOn) {
8029
8051
  this.loadContent(index, true);
8030
- }
8052
+ } else {
8053
+ setTimeout(function () {
8054
+ _this14.loadContent(index, true); // Add title if this.settings.appendSubHtmlTo === lg-sub-html
8031
8055
 
8032
- setTimeout(function () {
8033
- if (_this15.lGalleryOn) {
8034
- _this15.loadContent(index, true);
8035
- } // Add title if this.settings.appendSubHtmlTo === lg-sub-html
8036
8056
 
8057
+ if (_this14.settings.appendSubHtmlTo !== '.lg-item') {
8058
+ _this14.addHtml(index);
8059
+ }
8060
+ }, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
8061
+ }
8037
8062
 
8038
- if (_this15.settings.appendSubHtmlTo !== '.lg-item') {
8039
- _this15.addHtml(index);
8040
- }
8041
- }, (this.lGalleryOn ? this.settings.speed + 50 : 50) + (fromTouch ? 0 : this.settings.slideDelay));
8042
8063
  setTimeout(function () {
8043
- _this15.lgBusy = false;
8064
+ _this14.lgBusy = false;
8044
8065
  previousSlideItem.removeClass('lg-slide-progress');
8045
8066
 
8046
- _this15.LGel.trigger(lGEvents.afterSlide, {
8067
+ _this14.LGel.trigger(lGEvents.afterSlide, {
8047
8068
  prevIndex: prevIndex,
8048
8069
  index: index,
8049
8070
  fromTouch: fromTouch,
@@ -8130,7 +8151,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8130
8151
  }, {
8131
8152
  key: "touchEnd",
8132
8153
  value: function touchEnd(endCoords, startCoords, event) {
8133
- var _this16 = this;
8154
+ var _this15 = this;
8134
8155
 
8135
8156
  var distance; // keep slide animation for any mode while dragg/swipe
8136
8157
 
@@ -8140,61 +8161,61 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8140
8161
 
8141
8162
 
8142
8163
  setTimeout(function () {
8143
- _this16.$container.removeClass('lg-dragging-vertical');
8164
+ _this15.$container.removeClass('lg-dragging-vertical');
8144
8165
 
8145
- _this16.outer.removeClass('lg-dragging lg-hide-items').addClass('lg-components-open');
8166
+ _this15.outer.removeClass('lg-dragging lg-hide-items').addClass('lg-components-open');
8146
8167
 
8147
8168
  var triggerClick = true;
8148
8169
 
8149
- if (_this16.swipeDirection === 'horizontal') {
8170
+ if (_this15.swipeDirection === 'horizontal') {
8150
8171
  distance = endCoords.pageX - startCoords.pageX;
8151
8172
  var distanceAbs = Math.abs(endCoords.pageX - startCoords.pageX);
8152
8173
 
8153
- if (distance < 0 && distanceAbs > _this16.settings.swipeThreshold) {
8154
- _this16.goToNextSlide(true);
8174
+ if (distance < 0 && distanceAbs > _this15.settings.swipeThreshold) {
8175
+ _this15.goToNextSlide(true);
8155
8176
 
8156
8177
  triggerClick = false;
8157
- } else if (distance > 0 && distanceAbs > _this16.settings.swipeThreshold) {
8158
- _this16.goToPrevSlide(true);
8178
+ } else if (distance > 0 && distanceAbs > _this15.settings.swipeThreshold) {
8179
+ _this15.goToPrevSlide(true);
8159
8180
 
8160
8181
  triggerClick = false;
8161
8182
  }
8162
- } else if (_this16.swipeDirection === 'vertical') {
8183
+ } else if (_this15.swipeDirection === 'vertical') {
8163
8184
  distance = Math.abs(endCoords.pageY - startCoords.pageY);
8164
8185
 
8165
- if (_this16.settings.closable && _this16.settings.swipeToClose && distance > 100) {
8166
- _this16.closeGallery();
8186
+ if (_this15.settings.closable && _this15.settings.swipeToClose && distance > 100) {
8187
+ _this15.closeGallery();
8167
8188
 
8168
8189
  return;
8169
8190
  } else {
8170
- _this16.$backdrop.css('opacity', 1);
8191
+ _this15.$backdrop.css('opacity', 1);
8171
8192
  }
8172
8193
  }
8173
8194
 
8174
- _this16.outer.find('.lg-item').removeAttr('style');
8195
+ _this15.outer.find('.lg-item').removeAttr('style');
8175
8196
 
8176
8197
  if (triggerClick && Math.abs(endCoords.pageX - startCoords.pageX) < 5) {
8177
8198
  // Trigger click if distance is less than 5 pix
8178
8199
  var target = $LG(event.target);
8179
8200
 
8180
- if (_this16.isPosterElement(target)) {
8181
- _this16.LGel.trigger(lGEvents.posterClick);
8201
+ if (_this15.isPosterElement(target)) {
8202
+ _this15.LGel.trigger(lGEvents.posterClick);
8182
8203
  }
8183
8204
  }
8184
8205
 
8185
- _this16.swipeDirection = undefined;
8206
+ _this15.swipeDirection = undefined;
8186
8207
  }); // remove slide class once drag/swipe is completed if mode is not slide
8187
8208
 
8188
8209
  setTimeout(function () {
8189
- if (!_this16.outer.hasClass('lg-dragging') && _this16.settings.mode !== 'lg-slide') {
8190
- _this16.outer.removeClass('lg-slide');
8210
+ if (!_this15.outer.hasClass('lg-dragging') && _this15.settings.mode !== 'lg-slide') {
8211
+ _this15.outer.removeClass('lg-slide');
8191
8212
  }
8192
8213
  }, this.settings.speed + 100);
8193
8214
  }
8194
8215
  }, {
8195
8216
  key: "enableSwipe",
8196
8217
  value: function enableSwipe() {
8197
- var _this17 = this;
8218
+ var _this16 = this;
8198
8219
 
8199
8220
  var startCoords = {};
8200
8221
  var endCoords = {};
@@ -8203,15 +8224,15 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8203
8224
 
8204
8225
  if (this.settings.enableSwipe) {
8205
8226
  this.$inner.on('touchstart.lg', function (e) {
8206
- _this17.dragOrSwipeEnabled = true;
8227
+ _this16.dragOrSwipeEnabled = true;
8207
8228
 
8208
- var $item = _this17.getSlideItem(_this17.index);
8229
+ var $item = _this16.getSlideItem(_this16.index);
8209
8230
 
8210
- if (($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) && !_this17.outer.hasClass('lg-zoomed') && !_this17.lgBusy && e.targetTouches.length === 1) {
8231
+ if (($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) && !_this16.outer.hasClass('lg-zoomed') && !_this16.lgBusy && e.targetTouches.length === 1) {
8211
8232
  isSwiping = true;
8212
- _this17.touchAction = 'swipe';
8233
+ _this16.touchAction = 'swipe';
8213
8234
 
8214
- _this17.manageSwipeClass();
8235
+ _this16.manageSwipeClass();
8215
8236
 
8216
8237
  startCoords = {
8217
8238
  pageX: e.targetTouches[0].pageX,
@@ -8220,32 +8241,32 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8220
8241
  }
8221
8242
  });
8222
8243
  this.$inner.on('touchmove.lg', function (e) {
8223
- if (isSwiping && _this17.touchAction === 'swipe' && e.targetTouches.length === 1) {
8244
+ if (isSwiping && _this16.touchAction === 'swipe' && e.targetTouches.length === 1) {
8224
8245
  endCoords = {
8225
8246
  pageX: e.targetTouches[0].pageX,
8226
8247
  pageY: e.targetTouches[0].pageY
8227
8248
  };
8228
8249
 
8229
- _this17.touchMove(startCoords, endCoords, e);
8250
+ _this16.touchMove(startCoords, endCoords, e);
8230
8251
 
8231
8252
  isMoved = true;
8232
8253
  }
8233
8254
  });
8234
8255
  this.$inner.on('touchend.lg', function (event) {
8235
- if (_this17.touchAction === 'swipe') {
8256
+ if (_this16.touchAction === 'swipe') {
8236
8257
  if (isMoved) {
8237
8258
  isMoved = false;
8238
8259
 
8239
- _this17.touchEnd(endCoords, startCoords, event);
8260
+ _this16.touchEnd(endCoords, startCoords, event);
8240
8261
  } else if (isSwiping) {
8241
8262
  var target = $LG(event.target);
8242
8263
 
8243
- if (_this17.isPosterElement(target)) {
8244
- _this17.LGel.trigger(lGEvents.posterClick);
8264
+ if (_this16.isPosterElement(target)) {
8265
+ _this16.LGel.trigger(lGEvents.posterClick);
8245
8266
  }
8246
8267
  }
8247
8268
 
8248
- _this17.touchAction = undefined;
8269
+ _this16.touchAction = undefined;
8249
8270
  isSwiping = false;
8250
8271
  }
8251
8272
  });
@@ -8254,7 +8275,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8254
8275
  }, {
8255
8276
  key: "enableDrag",
8256
8277
  value: function enableDrag() {
8257
- var _this18 = this;
8278
+ var _this17 = this;
8258
8279
 
8259
8280
  var startCoords = {};
8260
8281
  var endCoords = {};
@@ -8263,16 +8284,16 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8263
8284
 
8264
8285
  if (this.settings.enableDrag) {
8265
8286
  this.outer.on('mousedown.lg', function (e) {
8266
- _this18.dragOrSwipeEnabled = true;
8287
+ _this17.dragOrSwipeEnabled = true;
8267
8288
 
8268
- var $item = _this18.getSlideItem(_this18.index);
8289
+ var $item = _this17.getSlideItem(_this17.index);
8269
8290
 
8270
8291
  if ($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) {
8271
- if (!_this18.outer.hasClass('lg-zoomed') && !_this18.lgBusy) {
8292
+ if (!_this17.outer.hasClass('lg-zoomed') && !_this17.lgBusy) {
8272
8293
  e.preventDefault();
8273
8294
 
8274
- if (!_this18.lgBusy) {
8275
- _this18.manageSwipeClass();
8295
+ if (!_this17.lgBusy) {
8296
+ _this17.manageSwipeClass();
8276
8297
 
8277
8298
  startCoords = {
8278
8299
  pageX: e.pageX,
@@ -8280,31 +8301,31 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8280
8301
  };
8281
8302
  isDraging = true; // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
8282
8303
 
8283
- _this18.outer.get().scrollLeft += 1;
8284
- _this18.outer.get().scrollLeft -= 1; // *
8304
+ _this17.outer.get().scrollLeft += 1;
8305
+ _this17.outer.get().scrollLeft -= 1; // *
8285
8306
 
8286
- _this18.outer.removeClass('lg-grab').addClass('lg-grabbing');
8307
+ _this17.outer.removeClass('lg-grab').addClass('lg-grabbing');
8287
8308
 
8288
- _this18.LGel.trigger(lGEvents.dragStart);
8309
+ _this17.LGel.trigger(lGEvents.dragStart);
8289
8310
  }
8290
8311
  }
8291
8312
  }
8292
8313
  });
8293
8314
  $LG(window).on("mousemove.lg.global".concat(this.lgId), function (e) {
8294
- if (isDraging && _this18.lgOpened) {
8315
+ if (isDraging && _this17.lgOpened) {
8295
8316
  isMoved = true;
8296
8317
  endCoords = {
8297
8318
  pageX: e.pageX,
8298
8319
  pageY: e.pageY
8299
8320
  };
8300
8321
 
8301
- _this18.touchMove(startCoords, endCoords);
8322
+ _this17.touchMove(startCoords, endCoords);
8302
8323
 
8303
- _this18.LGel.trigger(lGEvents.dragMove);
8324
+ _this17.LGel.trigger(lGEvents.dragMove);
8304
8325
  }
8305
8326
  });
8306
8327
  $LG(window).on("mouseup.lg.global".concat(this.lgId), function (event) {
8307
- if (!_this18.lgOpened) {
8328
+ if (!_this17.lgOpened) {
8308
8329
  return;
8309
8330
  }
8310
8331
 
@@ -8313,18 +8334,18 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8313
8334
  if (isMoved) {
8314
8335
  isMoved = false;
8315
8336
 
8316
- _this18.touchEnd(endCoords, startCoords, event);
8337
+ _this17.touchEnd(endCoords, startCoords, event);
8317
8338
 
8318
- _this18.LGel.trigger(lGEvents.dragEnd);
8319
- } else if (_this18.isPosterElement(target)) {
8320
- _this18.LGel.trigger(lGEvents.posterClick);
8339
+ _this17.LGel.trigger(lGEvents.dragEnd);
8340
+ } else if (_this17.isPosterElement(target)) {
8341
+ _this17.LGel.trigger(lGEvents.posterClick);
8321
8342
  } // Prevent execution on click
8322
8343
 
8323
8344
 
8324
8345
  if (isDraging) {
8325
8346
  isDraging = false;
8326
8347
 
8327
- _this18.outer.removeClass('lg-grabbing').addClass('lg-grab');
8348
+ _this17.outer.removeClass('lg-grabbing').addClass('lg-grab');
8328
8349
  }
8329
8350
  });
8330
8351
  }
@@ -8332,11 +8353,11 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8332
8353
  }, {
8333
8354
  key: "triggerPosterClick",
8334
8355
  value: function triggerPosterClick() {
8335
- var _this19 = this;
8356
+ var _this18 = this;
8336
8357
 
8337
8358
  this.$inner.on('click.lg', function (event) {
8338
- if (!_this19.dragOrSwipeEnabled && _this19.isPosterElement($LG(event.target))) {
8339
- _this19.LGel.trigger(lGEvents.posterClick);
8359
+ if (!_this18.dragOrSwipeEnabled && _this18.isPosterElement($LG(event.target))) {
8360
+ _this18.LGel.trigger(lGEvents.posterClick);
8340
8361
  }
8341
8362
  });
8342
8363
  }
@@ -8376,7 +8397,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8376
8397
  }, {
8377
8398
  key: "goToNextSlide",
8378
8399
  value: function goToNextSlide(fromTouch) {
8379
- var _this20 = this;
8400
+ var _this19 = this;
8380
8401
 
8381
8402
  var _loop = this.settings.loop;
8382
8403
 
@@ -8401,7 +8422,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8401
8422
  } else if (this.settings.slideEndAnimation && !fromTouch) {
8402
8423
  this.outer.addClass('lg-right-end');
8403
8424
  setTimeout(function () {
8404
- _this20.outer.removeClass('lg-right-end');
8425
+ _this19.outer.removeClass('lg-right-end');
8405
8426
  }, 400);
8406
8427
  }
8407
8428
  }
@@ -8421,7 +8442,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8421
8442
  }, {
8422
8443
  key: "goToPrevSlide",
8423
8444
  value: function goToPrevSlide(fromTouch) {
8424
- var _this21 = this;
8445
+ var _this20 = this;
8425
8446
 
8426
8447
  var _loop = this.settings.loop;
8427
8448
 
@@ -8448,7 +8469,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8448
8469
  } else if (this.settings.slideEndAnimation && !fromTouch) {
8449
8470
  this.outer.addClass('lg-left-end');
8450
8471
  setTimeout(function () {
8451
- _this21.outer.removeClass('lg-left-end');
8472
+ _this20.outer.removeClass('lg-left-end');
8452
8473
  }, 400);
8453
8474
  }
8454
8475
  }
@@ -8457,30 +8478,30 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8457
8478
  }, {
8458
8479
  key: "keyPress",
8459
8480
  value: function keyPress() {
8460
- var _this22 = this;
8481
+ var _this21 = this;
8461
8482
 
8462
8483
  $LG(window).on("keydown.lg.global".concat(this.lgId), function (e) {
8463
- if (_this22.lgOpened && _this22.settings.escKey === true && e.keyCode === 27) {
8484
+ if (_this21.lgOpened && _this21.settings.escKey === true && e.keyCode === 27) {
8464
8485
  e.preventDefault();
8465
8486
 
8466
- if (_this22.settings.allowMediaOverlap && _this22.outer.hasClass('lg-can-toggle') && _this22.outer.hasClass('lg-components-open')) {
8467
- _this22.outer.removeClass('lg-components-open');
8487
+ if (_this21.settings.allowMediaOverlap && _this21.outer.hasClass('lg-can-toggle') && _this21.outer.hasClass('lg-components-open')) {
8488
+ _this21.outer.removeClass('lg-components-open');
8468
8489
  } else {
8469
- _this22.closeGallery();
8490
+ _this21.closeGallery();
8470
8491
  }
8471
8492
  }
8472
8493
 
8473
- if (_this22.lgOpened && _this22.galleryItems.length > 1) {
8494
+ if (_this21.lgOpened && _this21.galleryItems.length > 1) {
8474
8495
  if (e.keyCode === 37) {
8475
8496
  e.preventDefault();
8476
8497
 
8477
- _this22.goToPrevSlide();
8498
+ _this21.goToPrevSlide();
8478
8499
  }
8479
8500
 
8480
8501
  if (e.keyCode === 39) {
8481
8502
  e.preventDefault();
8482
8503
 
8483
- _this22.goToNextSlide();
8504
+ _this21.goToNextSlide();
8484
8505
  }
8485
8506
  }
8486
8507
  });
@@ -8488,13 +8509,13 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8488
8509
  }, {
8489
8510
  key: "arrow",
8490
8511
  value: function arrow() {
8491
- var _this23 = this;
8512
+ var _this22 = this;
8492
8513
 
8493
8514
  this.getElementById('lg-prev').on('click.lg', function () {
8494
- _this23.goToPrevSlide();
8515
+ _this22.goToPrevSlide();
8495
8516
  });
8496
8517
  this.getElementById('lg-next').on('click.lg', function () {
8497
- _this23.goToNextSlide();
8518
+ _this22.goToNextSlide();
8498
8519
  });
8499
8520
  }
8500
8521
  }, {
@@ -8528,20 +8549,22 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8528
8549
  }, {
8529
8550
  key: "mousewheel",
8530
8551
  value: function mousewheel() {
8531
- var _this24 = this;
8552
+ var _this23 = this;
8532
8553
 
8533
8554
  this.outer.on('mousewheel.lg', function (e) {
8534
- if (!e.deltaY || _this24.galleryItems.length < 2) {
8555
+ if (!e.deltaY || _this23.galleryItems.length < 2) {
8535
8556
  return;
8536
8557
  }
8537
8558
 
8538
8559
  if (e.deltaY > 0) {
8539
- _this24.goToPrevSlide();
8540
- } else {
8541
- _this24.goToNextSlide();
8542
- }
8560
+ _this23.goToNextSlide();
8561
+
8562
+ e.preventDefault();
8563
+ } else if (e.deltaY < 0) {
8564
+ _this23.goToPrevSlide();
8543
8565
 
8544
- e.preventDefault();
8566
+ e.preventDefault();
8567
+ }
8545
8568
  });
8546
8569
  }
8547
8570
  }, {
@@ -8563,12 +8586,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8563
8586
  }, {
8564
8587
  key: "toggleMaximize",
8565
8588
  value: function toggleMaximize() {
8566
- var _this25 = this;
8589
+ var _this24 = this;
8567
8590
 
8568
8591
  this.getElementById('lg-maximize').on('click.lg', function () {
8569
- _this25.$container.toggleClass('lg-inline');
8592
+ _this24.$container.toggleClass('lg-inline');
8570
8593
 
8571
- _this25.refreshOnResize();
8594
+ _this24.refreshOnResize();
8572
8595
  });
8573
8596
  }
8574
8597
  }, {
@@ -8583,12 +8606,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8583
8606
  }, {
8584
8607
  key: "manageCloseGallery",
8585
8608
  value: function manageCloseGallery() {
8586
- var _this26 = this;
8609
+ var _this25 = this;
8587
8610
 
8588
8611
  if (!this.settings.closable) return;
8589
8612
  var mousedown = false;
8590
8613
  this.getElementById('lg-close').on('click.lg', function () {
8591
- _this26.closeGallery();
8614
+ _this25.closeGallery();
8592
8615
  });
8593
8616
 
8594
8617
  if (this.settings.closeOnTap) {
@@ -8597,7 +8620,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8597
8620
  this.outer.on('mousedown.lg', function (e) {
8598
8621
  var target = $LG(e.target);
8599
8622
 
8600
- if (_this26.isSlideElement(target)) {
8623
+ if (_this25.isSlideElement(target)) {
8601
8624
  mousedown = true;
8602
8625
  } else {
8603
8626
  mousedown = false;
@@ -8609,9 +8632,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8609
8632
  this.outer.on('mouseup.lg', function (e) {
8610
8633
  var target = $LG(e.target);
8611
8634
 
8612
- if (_this26.isSlideElement(target) && mousedown) {
8613
- if (!_this26.outer.hasClass('lg-dragging')) {
8614
- _this26.closeGallery();
8635
+ if (_this25.isSlideElement(target) && mousedown) {
8636
+ if (!_this25.outer.hasClass('lg-dragging')) {
8637
+ _this25.closeGallery();
8615
8638
  }
8616
8639
  }
8617
8640
  });
@@ -8632,7 +8655,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8632
8655
  }, {
8633
8656
  key: "closeGallery",
8634
8657
  value: function closeGallery(force) {
8635
- var _this27 = this;
8658
+ var _this26 = this;
8636
8659
 
8637
8660
  if (!this.lgOpened || !this.settings.closable && !force) {
8638
8661
  return 0;
@@ -8650,7 +8673,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8650
8673
  var _this$galleryItems$th = this.galleryItems[this.index],
8651
8674
  __slideVideoInfo = _this$galleryItems$th.__slideVideoInfo,
8652
8675
  poster = _this$galleryItems$th.poster;
8653
- var imageSize = lg_utils.getSize(currentItem, this.outer, top + bottom, __slideVideoInfo && !poster, __slideVideoInfo && poster && this.settings.videoMaxSize);
8676
+ var imageSize = lg_utils.getSize(currentItem, this.outer, top + bottom, __slideVideoInfo && poster && this.settings.videoMaxSize);
8654
8677
  transform = lg_utils.getTransform(currentItem, this.outer, top, bottom, imageSize);
8655
8678
  }
8656
8679
 
@@ -8681,32 +8704,32 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8681
8704
  this.$container.removeClass('lg-show-in'); // Once the closign animation is completed and gallery is invisible
8682
8705
 
8683
8706
  setTimeout(function () {
8684
- if (_this27.zoomFromOrigin && transform) {
8685
- _this27.outer.removeClass('lg-zoom-from-image');
8707
+ if (_this26.zoomFromOrigin && transform) {
8708
+ _this26.outer.removeClass('lg-zoom-from-image');
8686
8709
  }
8687
8710
 
8688
- _this27.$container.removeClass('lg-show'); // Need to remove inline opacity as it is used in the stylesheet as well
8711
+ _this26.$container.removeClass('lg-show'); // Need to remove inline opacity as it is used in the stylesheet as well
8689
8712
 
8690
8713
 
8691
- _this27.$backdrop.removeAttr('style').css('transition-duration', _this27.settings.backdropDuration + 'ms');
8714
+ _this26.$backdrop.removeAttr('style').css('transition-duration', _this26.settings.backdropDuration + 'ms');
8692
8715
 
8693
- _this27.outer.removeClass("lg-closing ".concat(_this27.settings.startClass));
8716
+ _this26.outer.removeClass("lg-closing ".concat(_this26.settings.startClass));
8694
8717
 
8695
- _this27.getSlideItem(_this27.index).removeClass('lg-start-end-progress');
8718
+ _this26.getSlideItem(_this26.index).removeClass('lg-start-end-progress');
8696
8719
 
8697
- _this27.$inner.empty();
8720
+ _this26.$inner.empty();
8698
8721
 
8699
- if (_this27.lgOpened) {
8700
- _this27.LGel.trigger(lGEvents.afterClose, {
8701
- instance: _this27
8722
+ if (_this26.lgOpened) {
8723
+ _this26.LGel.trigger(lGEvents.afterClose, {
8724
+ instance: _this26
8702
8725
  });
8703
8726
  }
8704
8727
 
8705
- if (_this27.outer.get()) {
8706
- _this27.outer.get().blur();
8728
+ if (_this26.outer.get()) {
8729
+ _this26.outer.get().blur();
8707
8730
  }
8708
8731
 
8709
- _this27.lgOpened = false;
8732
+ _this26.lgOpened = false;
8710
8733
  }, removeTimeout + 100);
8711
8734
  return removeTimeout + 100;
8712
8735
  }
@@ -8792,21 +8815,21 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8792
8815
  }, {
8793
8816
  key: "destroy",
8794
8817
  value: function destroy() {
8795
- var _this28 = this;
8818
+ var _this27 = this;
8796
8819
 
8797
8820
  var closeTimeout = this.closeGallery(true);
8798
8821
  setTimeout(function () {
8799
- _this28.destroyModules(true);
8822
+ _this27.destroyModules(true);
8800
8823
 
8801
- if (!_this28.settings.dynamic) {
8802
- _this28.invalidateItems();
8824
+ if (!_this27.settings.dynamic) {
8825
+ _this27.invalidateItems();
8803
8826
  }
8804
8827
 
8805
- $LG(window).off(".lg.global".concat(_this28.lgId));
8828
+ $LG(window).off(".lg.global".concat(_this27.lgId));
8806
8829
 
8807
- _this28.LGel.off('.lg');
8830
+ _this27.LGel.off('.lg');
8808
8831
 
8809
- _this28.$container.remove();
8832
+ _this27.$container.remove();
8810
8833
  }, closeTimeout);
8811
8834
  return closeTimeout;
8812
8835
  }