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
@@ -5814,9 +5814,6 @@ var es_array_concat = __webpack_require__("99af");
5814
5814
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
5815
5815
  var es_array_find = __webpack_require__("7db0");
5816
5816
 
5817
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.match.js
5818
- var es_string_match = __webpack_require__("466d");
5819
-
5820
5817
  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
5821
5818
  function arrayLikeToArray_arrayLikeToArray(arr, len) {
5822
5819
  if (len == null || len > arr.length) len = arr.length;
@@ -5904,6 +5901,9 @@ var es_array_map = __webpack_require__("d81d");
5904
5901
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.splice.js
5905
5902
  var es_array_splice = __webpack_require__("a434");
5906
5903
 
5904
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.match.js
5905
+ var es_string_match = __webpack_require__("466d");
5906
+
5907
5907
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
5908
5908
  var es_promise = __webpack_require__("e6cf");
5909
5909
 
@@ -5924,28 +5924,30 @@ var es_regexp_to_string = __webpack_require__("25f0");
5924
5924
 
5925
5925
 
5926
5926
 
5927
- (function () {
5928
- if (typeof window.CustomEvent === 'function') return false;
5927
+ function initLgPolyfills() {
5928
+ (function () {
5929
+ if (typeof window.CustomEvent === 'function') return false;
5929
5930
 
5930
- function CustomEvent(event, params) {
5931
- params = params || {
5932
- bubbles: false,
5933
- cancelable: false,
5934
- detail: null
5935
- };
5936
- var evt = document.createEvent('CustomEvent');
5937
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
5938
- return evt;
5939
- }
5931
+ function CustomEvent(event, params) {
5932
+ params = params || {
5933
+ bubbles: false,
5934
+ cancelable: false,
5935
+ detail: null
5936
+ };
5937
+ var evt = document.createEvent('CustomEvent');
5938
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
5939
+ return evt;
5940
+ }
5940
5941
 
5941
- window.CustomEvent = CustomEvent;
5942
- })();
5942
+ window.CustomEvent = CustomEvent;
5943
+ })();
5943
5944
 
5944
- (function () {
5945
- if (!Element.prototype.matches) {
5946
- Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
5947
- }
5948
- })();
5945
+ (function () {
5946
+ if (!Element.prototype.matches) {
5947
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
5948
+ }
5949
+ })();
5950
+ }
5949
5951
 
5950
5952
  var lgQuery_lgQuery = /*#__PURE__*/function () {
5951
5953
  function lgQuery(selector) {
@@ -6108,7 +6110,9 @@ var lgQuery_lgQuery = /*#__PURE__*/function () {
6108
6110
  this._each(function (el) {
6109
6111
  // IE doesn't support multiple arguments
6110
6112
  classNames.split(' ').forEach(function (className) {
6111
- el.classList.add(className);
6113
+ if (className) {
6114
+ el.classList.add(className);
6115
+ }
6112
6116
  });
6113
6117
  });
6114
6118
 
@@ -6120,7 +6124,9 @@ var lgQuery_lgQuery = /*#__PURE__*/function () {
6120
6124
  this._each(function (el) {
6121
6125
  // IE doesn't support multiple arguments
6122
6126
  classNames.split(' ').forEach(function (className) {
6123
- el.classList.remove(className);
6127
+ if (className) {
6128
+ el.classList.remove(className);
6129
+ }
6124
6130
  });
6125
6131
  });
6126
6132
 
@@ -6382,6 +6388,7 @@ var lgQuery_lgQuery = /*#__PURE__*/function () {
6382
6388
  }();
6383
6389
  lgQuery_lgQuery.eventListeners = {};
6384
6390
  function $LG(selector) {
6391
+ initLgPolyfills();
6385
6392
  return new lgQuery_lgQuery(selector);
6386
6393
  }
6387
6394
  // CONCATENATED MODULE: ../src/lg-utils.ts
@@ -6398,6 +6405,7 @@ function $LG(selector) {
6398
6405
 
6399
6406
 
6400
6407
 
6408
+
6401
6409
  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
6402
6410
 
6403
6411
  function convertToData(attr) {
@@ -6417,15 +6425,13 @@ var utils = {
6417
6425
  /**
6418
6426
  * get possible width and height from the lgSize attribute. Used for ZoomFromOrigin option
6419
6427
  */
6420
- // @todo improive this
6421
6428
  getSize: function getSize(el, container) {
6422
6429
  var spacing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
6423
- var isDisabled = arguments.length > 3 ? arguments[3] : undefined;
6424
- var defaultLgSize = arguments.length > 4 ? arguments[4] : undefined;
6430
+ var defaultLgSize = arguments.length > 3 ? arguments[3] : undefined;
6425
6431
  var LGel = $LG(el);
6426
6432
  var lgSize = LGel.attr('data-lg-size') || defaultLgSize;
6427
6433
 
6428
- if (!lgSize || isDisabled) {
6434
+ if (!lgSize) {
6429
6435
  return;
6430
6436
  }
6431
6437
 
@@ -6627,6 +6633,45 @@ var utils = {
6627
6633
  },
6628
6634
  isMobile: function isMobile() {
6629
6635
  return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
6636
+ },
6637
+
6638
+ /**
6639
+ * @desc Check the given src is video
6640
+ * @param {String} src
6641
+ * @return {Object} video type
6642
+ * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
6643
+ *
6644
+ * @todo - this information can be moved to dynamicEl to avoid frequent calls
6645
+ */
6646
+ isVideo: function isVideo(src, isHTML5VIdeo, index) {
6647
+ if (!src) {
6648
+ if (isHTML5VIdeo) {
6649
+ return {
6650
+ html5: true
6651
+ };
6652
+ } else {
6653
+ 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/');
6654
+ return;
6655
+ }
6656
+ }
6657
+
6658
+ var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
6659
+ var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)(.*)?/i);
6660
+ var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
6661
+
6662
+ if (youtube) {
6663
+ return {
6664
+ youtube: youtube
6665
+ };
6666
+ } else if (vimeo) {
6667
+ return {
6668
+ vimeo: vimeo
6669
+ };
6670
+ } else if (wistia) {
6671
+ return {
6672
+ wistia: wistia
6673
+ };
6674
+ }
6630
6675
  }
6631
6676
  };
6632
6677
  /* harmony default export */ var lg_utils = (utils);
@@ -6641,7 +6686,7 @@ var lightGalleryCoreSettings = {
6641
6686
  addClass: '',
6642
6687
  startClass: 'lg-start-zoom',
6643
6688
  backdropDuration: 300,
6644
- container: document.body,
6689
+ container: '',
6645
6690
  startAnimationDuration: 400,
6646
6691
  zoomFromOrigin: true,
6647
6692
  hideBarsDelay: 0,
@@ -6670,7 +6715,6 @@ var lightGalleryCoreSettings = {
6670
6715
  subHtmlSelectorRelative: false,
6671
6716
  preload: 2,
6672
6717
  numberOfSlideItemsInDom: 10,
6673
- showAfterLoad: true,
6674
6718
  selector: '',
6675
6719
  selectWithin: '',
6676
6720
  nextHtml: '',
@@ -6739,7 +6783,6 @@ var lGEvents = {
6739
6783
 
6740
6784
 
6741
6785
 
6742
-
6743
6786
  // @ref - https://stackoverflow.com/questions/3971841/how-to-resize-images-proportionally-keeping-the-aspect-ratio
6744
6787
  // @ref - https://2ality.com/2017/04/setting-up-multi-platform-packages.html
6745
6788
  // Unique id for each gallery
@@ -6989,10 +7032,6 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
6989
7032
  outerClassNames += 'lg-grab ';
6990
7033
  }
6991
7034
 
6992
- if (this.settings.showAfterLoad) {
6993
- outerClassNames += 'lg-show-after-load';
6994
- }
6995
-
6996
7035
  this.outer.addClass(outerClassNames);
6997
7036
  this.$inner.css('transition-timing-function', this.settings.easing);
6998
7037
  this.$inner.css('transition-duration', this.settings.speed + 'ms');
@@ -7015,13 +7054,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7015
7054
  value: function refreshOnResize() {
7016
7055
  if (this.lgOpened) {
7017
7056
  var currentGalleryItem = this.galleryItems[this.index];
7018
- var __slideVideoInfo = currentGalleryItem.__slideVideoInfo,
7019
- poster = currentGalleryItem.poster;
7057
+ var __slideVideoInfo = currentGalleryItem.__slideVideoInfo;
7020
7058
  this.mediaContainerPosition = this.getMediaContainerPosition();
7021
7059
  var _this$mediaContainerP = this.mediaContainerPosition,
7022
7060
  top = _this$mediaContainerP.top,
7023
7061
  bottom = _this$mediaContainerP.bottom;
7024
- this.currentImageSize = lg_utils.getSize(this.items[this.index], this.outer, top + bottom, __slideVideoInfo && !poster, __slideVideoInfo && this.settings.videoMaxSize);
7062
+ this.currentImageSize = lg_utils.getSize(this.items[this.index], this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
7025
7063
 
7026
7064
  if (__slideVideoInfo) {
7027
7065
  this.resizeVideoSlide(this.index, this.currentImageSize);
@@ -7214,12 +7252,10 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7214
7252
  this.setMediaContainerPosition(top, bottom);
7215
7253
  }
7216
7254
 
7217
- var _this$galleryItems$in = this.galleryItems[index],
7218
- __slideVideoInfo = _this$galleryItems$in.__slideVideoInfo,
7219
- poster = _this$galleryItems$in.poster;
7255
+ var __slideVideoInfo = this.galleryItems[index].__slideVideoInfo;
7220
7256
 
7221
7257
  if (this.zoomFromOrigin && element) {
7222
- this.currentImageSize = lg_utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && !poster, __slideVideoInfo && this.settings.videoMaxSize);
7258
+ this.currentImageSize = lg_utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
7223
7259
  transform = lg_utils.getTransform(element, this.outer, top, bottom, this.currentImageSize);
7224
7260
  }
7225
7261
 
@@ -7505,7 +7541,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7505
7541
  var imgContent = '';
7506
7542
  var altAttr = alt ? 'alt="' + alt + '"' : '';
7507
7543
 
7508
- if (!this.lGalleryOn && this.zoomFromOrigin && this.currentImageSize) {
7544
+ if (this.isFirstSlideWithZoomAnimation()) {
7509
7545
  imgContent = this.getDummyImageContent($currentSlide, index, altAttr);
7510
7546
  } else {
7511
7547
  imgContent = lg_utils.getImgMarkup(index, src, altAttr, srcset, sizes, sources);
@@ -7515,94 +7551,73 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7515
7551
  $currentSlide.prepend(imgMarkup);
7516
7552
  }
7517
7553
  }, {
7518
- key: "onLgObjectLoad",
7519
- value: function onLgObjectLoad($el, index, delay, speed, dummyImageLoaded, isFirstSlide) {
7520
- var _this7 = this;
7554
+ key: "onSlideObjectLoad",
7555
+ value: function onSlideObjectLoad($slide, isHTML5VideoWithoutPoster, onLoad, onError) {
7556
+ var mediaObject = $slide.find('.lg-object').first();
7521
7557
 
7522
- if (dummyImageLoaded) {
7523
- this.LGel.trigger(lGEvents.slideItemLoad, {
7524
- index: index,
7525
- delay: delay || 0,
7526
- isFirstSlide: isFirstSlide
7558
+ if (lg_utils.isImageLoaded(mediaObject.get()) || isHTML5VideoWithoutPoster) {
7559
+ onLoad();
7560
+ } else {
7561
+ mediaObject.on('load.lg error.lg', function () {
7562
+ onLoad && onLoad();
7563
+ });
7564
+ mediaObject.on('error.lg', function () {
7565
+ onError && onError();
7527
7566
  });
7528
7567
  }
7568
+ }
7569
+ /**
7570
+ *
7571
+ * @param $el Current slide item
7572
+ * @param index
7573
+ * @param delay Delay is 0 except first time
7574
+ * @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin
7575
+ * @param isFirstSlide
7576
+ */
7577
+
7578
+ }, {
7579
+ key: "onLgObjectLoad",
7580
+ value: function onLgObjectLoad(currentSlide, index, delay, speed, isFirstSlide, isHTML5VideoWithoutPoster) {
7581
+ var _this7 = this;
7529
7582
 
7530
- $el.find('.lg-object').first().on('load.lg', function () {
7531
- _this7.handleLgObjectLoad($el, index, delay, speed, dummyImageLoaded, isFirstSlide);
7583
+ this.onSlideObjectLoad(currentSlide, isHTML5VideoWithoutPoster, function () {
7584
+ _this7.triggerSlideItemLoad(currentSlide, index, delay, speed, isFirstSlide);
7585
+ }, function () {
7586
+ currentSlide.addClass('lg-complete lg-complete_');
7587
+ currentSlide.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
7532
7588
  });
7533
- setTimeout(function () {
7534
- $el.find('.lg-object').first().on('error.lg', function () {
7535
- $el.addClass('lg-complete lg-complete_');
7536
- $el.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
7537
- });
7538
- }, speed);
7539
7589
  }
7540
7590
  }, {
7541
- key: "handleLgObjectLoad",
7542
- value: function handleLgObjectLoad($el, index, delay, speed, dummyImageLoaded, isFirstSlide) {
7591
+ key: "triggerSlideItemLoad",
7592
+ value: function triggerSlideItemLoad($currentSlide, index, delay, speed, isFirstSlide) {
7543
7593
  var _this8 = this;
7544
7594
 
7595
+ var currentGalleryItem = this.galleryItems[index]; // Adding delay for video slides without poster for better performance and user experience
7596
+ // Videos should start playing once once the gallery is completely loaded
7597
+
7598
+ var _speed = isFirstSlide && this.getSlideType(currentGalleryItem) === 'video' && !currentGalleryItem.poster ? speed : 0;
7599
+
7545
7600
  setTimeout(function () {
7546
- $el.addClass('lg-complete lg-complete_');
7601
+ $currentSlide.addClass('lg-complete lg-complete_');
7547
7602
 
7548
- if (!dummyImageLoaded) {
7549
- _this8.LGel.trigger(lGEvents.slideItemLoad, {
7550
- index: index,
7551
- delay: delay || 0,
7552
- isFirstSlide: isFirstSlide
7553
- });
7554
- }
7555
- }, speed);
7603
+ _this8.LGel.trigger(lGEvents.slideItemLoad, {
7604
+ index: index,
7605
+ delay: delay || 0,
7606
+ isFirstSlide: isFirstSlide
7607
+ });
7608
+ }, _speed);
7556
7609
  }
7557
- /**
7558
- * @desc Check the given src is video
7559
- * @param {String} src
7560
- * @return {Object} video type
7561
- * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
7562
- *
7563
- * @todo - this information can be moved to dynamicEl to avoid frequent calls
7564
- */
7565
-
7566
7610
  }, {
7567
- key: "isVideo",
7568
- value: function isVideo(src, index) {
7569
- if (!src) {
7570
- if (this.galleryItems[index].video) {
7571
- return {
7572
- html5: true
7573
- };
7574
- } else {
7575
- 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/');
7576
- return;
7577
- }
7578
- }
7579
-
7580
- var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
7581
- var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)/i);
7582
- var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
7583
-
7584
- if (youtube) {
7585
- return {
7586
- youtube: youtube
7587
- };
7588
- } else if (vimeo) {
7589
- return {
7590
- vimeo: vimeo
7591
- };
7592
- } else if (wistia) {
7593
- return {
7594
- wistia: wistia
7595
- };
7596
- }
7611
+ key: "isFirstSlideWithZoomAnimation",
7612
+ value: function isFirstSlideWithZoomAnimation() {
7613
+ return !!(!this.lGalleryOn && this.zoomFromOrigin && this.currentImageSize);
7597
7614
  } // Add video slideInfo
7598
7615
 
7599
7616
  }, {
7600
7617
  key: "addSlideVideoInfo",
7601
7618
  value: function addSlideVideoInfo(items) {
7602
- var _this9 = this;
7603
-
7604
7619
  items.forEach(function (element, index) {
7605
- element.__slideVideoInfo = _this9.isVideo(element.src, index);
7620
+ element.__slideVideoInfo = lg_utils.isVideo(element.src, !!element.video, index);
7606
7621
  });
7607
7622
  }
7608
7623
  /**
@@ -7615,7 +7630,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7615
7630
  }, {
7616
7631
  key: "loadContent",
7617
7632
  value: function loadContent(index, rec) {
7618
- var _this10 = this;
7633
+ var _this9 = this;
7619
7634
 
7620
7635
  var currentGalleryItem = this.galleryItems[index];
7621
7636
  var $currentSlide = $LG(this.getSlideItemId(index));
@@ -7653,7 +7668,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7653
7668
  var _this$mediaContainerP3 = this.mediaContainerPosition,
7654
7669
  top = _this$mediaContainerP3.top,
7655
7670
  bottom = _this$mediaContainerP3.bottom;
7656
- var videoSize = lg_utils.getSize(this.items[index], this.outer, top + bottom, false, videoInfo && this.settings.videoMaxSize);
7671
+ var videoSize = lg_utils.getSize(this.items[index], this.outer, top + bottom, videoInfo && this.settings.videoMaxSize);
7657
7672
  lgVideoStyle = this.getVideoContStyle(videoSize);
7658
7673
  }
7659
7674
 
@@ -7689,8 +7704,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7689
7704
  index: index,
7690
7705
  src: src,
7691
7706
  html5Video: _html5Video,
7692
- hasPoster: !!poster,
7693
- isFirstSlide: isFirstSlide
7707
+ hasPoster: !!poster
7694
7708
  });
7695
7709
  }
7696
7710
 
@@ -7709,33 +7723,34 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7709
7723
 
7710
7724
  if (delay && !$LG(document.body).hasClass('lg-from-hash')) {
7711
7725
  _speed = delay;
7712
- } // Only for first slide
7726
+ } // Only for first slide and zoomFromOrigin is enabled
7713
7727
 
7714
7728
 
7715
- if (!this.lGalleryOn && this.zoomFromOrigin && this.currentImageSize) {
7729
+ if (this.isFirstSlideWithZoomAnimation()) {
7716
7730
  setTimeout(function () {
7717
7731
  $currentSlide.removeClass('lg-start-end-progress lg-start-progress').removeAttr('style');
7718
7732
  }, this.settings.startAnimationDuration + 100);
7719
7733
 
7720
7734
  if (!$currentSlide.hasClass('lg-loaded')) {
7721
7735
  setTimeout(function () {
7722
- $currentSlide.find('.lg-img-wrap').append(lg_utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
7736
+ if (_this9.getSlideType(currentGalleryItem) === 'image') {
7737
+ $currentSlide.find('.lg-img-wrap').append(lg_utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
7723
7738
 
7724
- if (srcset || sources) {
7725
- var _$img = $currentSlide.find('.lg-object');
7739
+ if (srcset || sources) {
7740
+ var _$img = $currentSlide.find('.lg-object');
7726
7741
 
7727
- _this10.initPictureFill(_$img);
7742
+ _this9.initPictureFill(_$img);
7743
+ }
7728
7744
  }
7729
7745
 
7730
- _this10.onLgObjectLoad($currentSlide, index, delay, _speed, true, true);
7746
+ if (_this9.getSlideType(currentGalleryItem) === 'image' || _this9.getSlideType(currentGalleryItem) === 'video' && poster) {
7747
+ _this9.onLgObjectLoad($currentSlide, index, delay, _speed, true, false); // load remaining slides once the slide is completely loaded
7731
7748
 
7732
- var mediaObject = $currentSlide.find('.lg-object').first();
7733
7749
 
7734
- if (lg_utils.isImageLoaded(mediaObject.get())) {
7735
- _this10.loadContentOnLoad(index, $currentSlide, _speed);
7736
- } else {
7737
- mediaObject.on('load.lg error.lg', function () {
7738
- _this10.loadContentOnLoad(index, $currentSlide, _speed);
7750
+ _this9.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
7751
+ _this9.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
7752
+ }, function () {
7753
+ _this9.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
7739
7754
  });
7740
7755
  }
7741
7756
  }, this.settings.startAnimationDuration + 100);
@@ -7744,10 +7759,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7744
7759
 
7745
7760
 
7746
7761
  $currentSlide.addClass('lg-loaded');
7747
- this.onLgObjectLoad($currentSlide, index, delay, _speed, false, isFirstSlide); // @todo check load state for html5 videos
7748
7762
 
7749
- if (videoInfo && videoInfo.html5 && !poster) {
7750
- $currentSlide.addClass('lg-complete lg-complete_');
7763
+ if (!this.isFirstSlideWithZoomAnimation() || this.getSlideType(currentGalleryItem) === 'video' && !poster) {
7764
+ this.onLgObjectLoad($currentSlide, index, delay, _speed, isFirstSlide, !!(videoInfo && videoInfo.html5 && !poster));
7751
7765
  } // When gallery is opened once content is loaded (second time) need to add lg-complete class for css styling
7752
7766
 
7753
7767
 
@@ -7764,33 +7778,41 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7764
7778
  if (rec === true) {
7765
7779
  if (!$currentSlide.hasClass('lg-complete_')) {
7766
7780
  $currentSlide.find('.lg-object').first().on('load.lg error.lg', function () {
7767
- _this10.preload(index);
7781
+ _this9.preload(index);
7768
7782
  });
7769
7783
  } else {
7770
7784
  this.preload(index);
7771
7785
  }
7772
7786
  }
7773
7787
  }
7788
+ /**
7789
+ * @desc Remove dummy image content and load next slides
7790
+ * Called only for the first time if zoomFromOrigin animation is enabled
7791
+ * @param index
7792
+ * @param $currentSlide
7793
+ * @param speed
7794
+ */
7795
+
7774
7796
  }, {
7775
- key: "loadContentOnLoad",
7776
- value: function loadContentOnLoad(index, $currentSlide, speed) {
7777
- var _this11 = this;
7797
+ key: "loadContentOnFirstSlideLoad",
7798
+ value: function loadContentOnFirstSlideLoad(index, $currentSlide, speed) {
7799
+ var _this10 = this;
7778
7800
 
7779
7801
  setTimeout(function () {
7780
7802
  $currentSlide.find('.lg-dummy-img').remove();
7781
7803
  $currentSlide.removeClass('lg-first-slide');
7782
7804
 
7783
- _this11.outer.removeClass('lg-first-slide-loading');
7805
+ _this10.outer.removeClass('lg-first-slide-loading');
7784
7806
 
7785
- _this11.isDummyImageRemoved = true;
7807
+ _this10.isDummyImageRemoved = true;
7786
7808
 
7787
- _this11.preload(index);
7809
+ _this10.preload(index);
7788
7810
  }, speed + 300);
7789
7811
  }
7790
7812
  }, {
7791
7813
  key: "getItemsToBeInsertedToDom",
7792
7814
  value: function getItemsToBeInsertedToDom(index, prevIndex) {
7793
- var _this12 = this;
7815
+ var _this11 = this;
7794
7816
 
7795
7817
  var numberOfItems = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
7796
7818
  var itemsToBeInsertedToDom = []; // Minimum 2 items should be there
@@ -7801,7 +7823,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7801
7823
 
7802
7824
  if (this.galleryItems.length <= 3) {
7803
7825
  this.galleryItems.forEach(function (_element, index) {
7804
- itemsToBeInsertedToDom.push("lg-item-".concat(_this12.lgId, "-").concat(index));
7826
+ itemsToBeInsertedToDom.push("lg-item-".concat(_this11.lgId, "-").concat(index));
7805
7827
  });
7806
7828
  return itemsToBeInsertedToDom;
7807
7829
  }
@@ -7845,12 +7867,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7845
7867
  }, {
7846
7868
  key: "organizeSlideItems",
7847
7869
  value: function organizeSlideItems(index, prevIndex) {
7848
- var _this13 = this;
7870
+ var _this12 = this;
7849
7871
 
7850
7872
  var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, prevIndex, this.settings.numberOfSlideItemsInDom);
7851
7873
  itemsToBeInsertedToDom.forEach(function (item) {
7852
- if (_this13.currentItemsInDom.indexOf(item) === -1) {
7853
- _this13.$inner.append("<div id=\"".concat(item, "\" class=\"lg-item\"></div>"));
7874
+ if (_this12.currentItemsInDom.indexOf(item) === -1) {
7875
+ _this12.$inner.append("<div id=\"".concat(item, "\" class=\"lg-item\"></div>"));
7854
7876
  }
7855
7877
  });
7856
7878
  this.currentItemsInDom.forEach(function (item) {
@@ -7901,7 +7923,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7901
7923
  }, {
7902
7924
  key: "makeSlideAnimation",
7903
7925
  value: function makeSlideAnimation(direction, currentSlideItem, previousSlideItem) {
7904
- var _this14 = this;
7926
+ var _this13 = this;
7905
7927
 
7906
7928
  if (this.lGalleryOn) {
7907
7929
  previousSlideItem.addClass('lg-slide-progress');
@@ -7909,9 +7931,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7909
7931
 
7910
7932
  setTimeout(function () {
7911
7933
  // remove all transitions
7912
- _this14.outer.addClass('lg-no-trans');
7934
+ _this13.outer.addClass('lg-no-trans');
7913
7935
 
7914
- _this14.outer.find('.lg-item').removeClass('lg-prev-slide lg-next-slide');
7936
+ _this13.outer.find('.lg-item').removeClass('lg-prev-slide lg-next-slide');
7915
7937
 
7916
7938
  if (direction === 'prev') {
7917
7939
  //prevslide
@@ -7925,11 +7947,11 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7925
7947
 
7926
7948
 
7927
7949
  setTimeout(function () {
7928
- _this14.outer.find('.lg-item').removeClass('lg-current');
7950
+ _this13.outer.find('.lg-item').removeClass('lg-current');
7929
7951
 
7930
7952
  currentSlideItem.addClass('lg-current'); // reset all transitions
7931
7953
 
7932
- _this14.outer.removeClass('lg-no-trans');
7954
+ _this13.outer.removeClass('lg-no-trans');
7933
7955
  }, 50);
7934
7956
  }, this.lGalleryOn ? this.settings.slideDelay : 0);
7935
7957
  }
@@ -7950,7 +7972,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7950
7972
  }, {
7951
7973
  key: "slide",
7952
7974
  value: function slide(index, fromTouch, fromThumb, direction) {
7953
- var _this15 = this;
7975
+ var _this14 = this;
7954
7976
 
7955
7977
  var prevIndex = this.getPreviousSlideIndex();
7956
7978
  this.currentItemsInDom = this.organizeSlideItems(index, prevIndex); // Prevent multiple call, Required for hsh plugin
@@ -7977,7 +7999,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
7977
7999
  var _this$mediaContainerP4 = this.mediaContainerPosition,
7978
8000
  top = _this$mediaContainerP4.top,
7979
8001
  bottom = _this$mediaContainerP4.bottom;
7980
- var videoSize = lg_utils.getSize(this.items[index], this.outer, top + bottom, false, videoInfo && this.settings.videoMaxSize);
8002
+ var videoSize = lg_utils.getSize(this.items[index], this.outer, top + bottom, videoInfo && this.settings.videoMaxSize);
7981
8003
  this.resizeVideoSlide(index, videoSize);
7982
8004
  }
7983
8005
 
@@ -8036,23 +8058,22 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8036
8058
 
8037
8059
  if (!this.lGalleryOn) {
8038
8060
  this.loadContent(index, true);
8039
- }
8061
+ } else {
8062
+ setTimeout(function () {
8063
+ _this14.loadContent(index, true); // Add title if this.settings.appendSubHtmlTo === lg-sub-html
8040
8064
 
8041
- setTimeout(function () {
8042
- if (_this15.lGalleryOn) {
8043
- _this15.loadContent(index, true);
8044
- } // Add title if this.settings.appendSubHtmlTo === lg-sub-html
8045
8065
 
8066
+ if (_this14.settings.appendSubHtmlTo !== '.lg-item') {
8067
+ _this14.addHtml(index);
8068
+ }
8069
+ }, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
8070
+ }
8046
8071
 
8047
- if (_this15.settings.appendSubHtmlTo !== '.lg-item') {
8048
- _this15.addHtml(index);
8049
- }
8050
- }, (this.lGalleryOn ? this.settings.speed + 50 : 50) + (fromTouch ? 0 : this.settings.slideDelay));
8051
8072
  setTimeout(function () {
8052
- _this15.lgBusy = false;
8073
+ _this14.lgBusy = false;
8053
8074
  previousSlideItem.removeClass('lg-slide-progress');
8054
8075
 
8055
- _this15.LGel.trigger(lGEvents.afterSlide, {
8076
+ _this14.LGel.trigger(lGEvents.afterSlide, {
8056
8077
  prevIndex: prevIndex,
8057
8078
  index: index,
8058
8079
  fromTouch: fromTouch,
@@ -8139,7 +8160,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8139
8160
  }, {
8140
8161
  key: "touchEnd",
8141
8162
  value: function touchEnd(endCoords, startCoords, event) {
8142
- var _this16 = this;
8163
+ var _this15 = this;
8143
8164
 
8144
8165
  var distance; // keep slide animation for any mode while dragg/swipe
8145
8166
 
@@ -8149,61 +8170,61 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8149
8170
 
8150
8171
 
8151
8172
  setTimeout(function () {
8152
- _this16.$container.removeClass('lg-dragging-vertical');
8173
+ _this15.$container.removeClass('lg-dragging-vertical');
8153
8174
 
8154
- _this16.outer.removeClass('lg-dragging lg-hide-items').addClass('lg-components-open');
8175
+ _this15.outer.removeClass('lg-dragging lg-hide-items').addClass('lg-components-open');
8155
8176
 
8156
8177
  var triggerClick = true;
8157
8178
 
8158
- if (_this16.swipeDirection === 'horizontal') {
8179
+ if (_this15.swipeDirection === 'horizontal') {
8159
8180
  distance = endCoords.pageX - startCoords.pageX;
8160
8181
  var distanceAbs = Math.abs(endCoords.pageX - startCoords.pageX);
8161
8182
 
8162
- if (distance < 0 && distanceAbs > _this16.settings.swipeThreshold) {
8163
- _this16.goToNextSlide(true);
8183
+ if (distance < 0 && distanceAbs > _this15.settings.swipeThreshold) {
8184
+ _this15.goToNextSlide(true);
8164
8185
 
8165
8186
  triggerClick = false;
8166
- } else if (distance > 0 && distanceAbs > _this16.settings.swipeThreshold) {
8167
- _this16.goToPrevSlide(true);
8187
+ } else if (distance > 0 && distanceAbs > _this15.settings.swipeThreshold) {
8188
+ _this15.goToPrevSlide(true);
8168
8189
 
8169
8190
  triggerClick = false;
8170
8191
  }
8171
- } else if (_this16.swipeDirection === 'vertical') {
8192
+ } else if (_this15.swipeDirection === 'vertical') {
8172
8193
  distance = Math.abs(endCoords.pageY - startCoords.pageY);
8173
8194
 
8174
- if (_this16.settings.closable && _this16.settings.swipeToClose && distance > 100) {
8175
- _this16.closeGallery();
8195
+ if (_this15.settings.closable && _this15.settings.swipeToClose && distance > 100) {
8196
+ _this15.closeGallery();
8176
8197
 
8177
8198
  return;
8178
8199
  } else {
8179
- _this16.$backdrop.css('opacity', 1);
8200
+ _this15.$backdrop.css('opacity', 1);
8180
8201
  }
8181
8202
  }
8182
8203
 
8183
- _this16.outer.find('.lg-item').removeAttr('style');
8204
+ _this15.outer.find('.lg-item').removeAttr('style');
8184
8205
 
8185
8206
  if (triggerClick && Math.abs(endCoords.pageX - startCoords.pageX) < 5) {
8186
8207
  // Trigger click if distance is less than 5 pix
8187
8208
  var target = $LG(event.target);
8188
8209
 
8189
- if (_this16.isPosterElement(target)) {
8190
- _this16.LGel.trigger(lGEvents.posterClick);
8210
+ if (_this15.isPosterElement(target)) {
8211
+ _this15.LGel.trigger(lGEvents.posterClick);
8191
8212
  }
8192
8213
  }
8193
8214
 
8194
- _this16.swipeDirection = undefined;
8215
+ _this15.swipeDirection = undefined;
8195
8216
  }); // remove slide class once drag/swipe is completed if mode is not slide
8196
8217
 
8197
8218
  setTimeout(function () {
8198
- if (!_this16.outer.hasClass('lg-dragging') && _this16.settings.mode !== 'lg-slide') {
8199
- _this16.outer.removeClass('lg-slide');
8219
+ if (!_this15.outer.hasClass('lg-dragging') && _this15.settings.mode !== 'lg-slide') {
8220
+ _this15.outer.removeClass('lg-slide');
8200
8221
  }
8201
8222
  }, this.settings.speed + 100);
8202
8223
  }
8203
8224
  }, {
8204
8225
  key: "enableSwipe",
8205
8226
  value: function enableSwipe() {
8206
- var _this17 = this;
8227
+ var _this16 = this;
8207
8228
 
8208
8229
  var startCoords = {};
8209
8230
  var endCoords = {};
@@ -8212,15 +8233,15 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8212
8233
 
8213
8234
  if (this.settings.enableSwipe) {
8214
8235
  this.$inner.on('touchstart.lg', function (e) {
8215
- _this17.dragOrSwipeEnabled = true;
8236
+ _this16.dragOrSwipeEnabled = true;
8216
8237
 
8217
- var $item = _this17.getSlideItem(_this17.index);
8238
+ var $item = _this16.getSlideItem(_this16.index);
8218
8239
 
8219
- if (($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) && !_this17.outer.hasClass('lg-zoomed') && !_this17.lgBusy && e.targetTouches.length === 1) {
8240
+ if (($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) && !_this16.outer.hasClass('lg-zoomed') && !_this16.lgBusy && e.targetTouches.length === 1) {
8220
8241
  isSwiping = true;
8221
- _this17.touchAction = 'swipe';
8242
+ _this16.touchAction = 'swipe';
8222
8243
 
8223
- _this17.manageSwipeClass();
8244
+ _this16.manageSwipeClass();
8224
8245
 
8225
8246
  startCoords = {
8226
8247
  pageX: e.targetTouches[0].pageX,
@@ -8229,32 +8250,32 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8229
8250
  }
8230
8251
  });
8231
8252
  this.$inner.on('touchmove.lg', function (e) {
8232
- if (isSwiping && _this17.touchAction === 'swipe' && e.targetTouches.length === 1) {
8253
+ if (isSwiping && _this16.touchAction === 'swipe' && e.targetTouches.length === 1) {
8233
8254
  endCoords = {
8234
8255
  pageX: e.targetTouches[0].pageX,
8235
8256
  pageY: e.targetTouches[0].pageY
8236
8257
  };
8237
8258
 
8238
- _this17.touchMove(startCoords, endCoords, e);
8259
+ _this16.touchMove(startCoords, endCoords, e);
8239
8260
 
8240
8261
  isMoved = true;
8241
8262
  }
8242
8263
  });
8243
8264
  this.$inner.on('touchend.lg', function (event) {
8244
- if (_this17.touchAction === 'swipe') {
8265
+ if (_this16.touchAction === 'swipe') {
8245
8266
  if (isMoved) {
8246
8267
  isMoved = false;
8247
8268
 
8248
- _this17.touchEnd(endCoords, startCoords, event);
8269
+ _this16.touchEnd(endCoords, startCoords, event);
8249
8270
  } else if (isSwiping) {
8250
8271
  var target = $LG(event.target);
8251
8272
 
8252
- if (_this17.isPosterElement(target)) {
8253
- _this17.LGel.trigger(lGEvents.posterClick);
8273
+ if (_this16.isPosterElement(target)) {
8274
+ _this16.LGel.trigger(lGEvents.posterClick);
8254
8275
  }
8255
8276
  }
8256
8277
 
8257
- _this17.touchAction = undefined;
8278
+ _this16.touchAction = undefined;
8258
8279
  isSwiping = false;
8259
8280
  }
8260
8281
  });
@@ -8263,7 +8284,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8263
8284
  }, {
8264
8285
  key: "enableDrag",
8265
8286
  value: function enableDrag() {
8266
- var _this18 = this;
8287
+ var _this17 = this;
8267
8288
 
8268
8289
  var startCoords = {};
8269
8290
  var endCoords = {};
@@ -8272,16 +8293,16 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8272
8293
 
8273
8294
  if (this.settings.enableDrag) {
8274
8295
  this.outer.on('mousedown.lg', function (e) {
8275
- _this18.dragOrSwipeEnabled = true;
8296
+ _this17.dragOrSwipeEnabled = true;
8276
8297
 
8277
- var $item = _this18.getSlideItem(_this18.index);
8298
+ var $item = _this17.getSlideItem(_this17.index);
8278
8299
 
8279
8300
  if ($LG(e.target).hasClass('lg-item') || $item.get().contains(e.target)) {
8280
- if (!_this18.outer.hasClass('lg-zoomed') && !_this18.lgBusy) {
8301
+ if (!_this17.outer.hasClass('lg-zoomed') && !_this17.lgBusy) {
8281
8302
  e.preventDefault();
8282
8303
 
8283
- if (!_this18.lgBusy) {
8284
- _this18.manageSwipeClass();
8304
+ if (!_this17.lgBusy) {
8305
+ _this17.manageSwipeClass();
8285
8306
 
8286
8307
  startCoords = {
8287
8308
  pageX: e.pageX,
@@ -8289,31 +8310,31 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8289
8310
  };
8290
8311
  isDraging = true; // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
8291
8312
 
8292
- _this18.outer.get().scrollLeft += 1;
8293
- _this18.outer.get().scrollLeft -= 1; // *
8313
+ _this17.outer.get().scrollLeft += 1;
8314
+ _this17.outer.get().scrollLeft -= 1; // *
8294
8315
 
8295
- _this18.outer.removeClass('lg-grab').addClass('lg-grabbing');
8316
+ _this17.outer.removeClass('lg-grab').addClass('lg-grabbing');
8296
8317
 
8297
- _this18.LGel.trigger(lGEvents.dragStart);
8318
+ _this17.LGel.trigger(lGEvents.dragStart);
8298
8319
  }
8299
8320
  }
8300
8321
  }
8301
8322
  });
8302
8323
  $LG(window).on("mousemove.lg.global".concat(this.lgId), function (e) {
8303
- if (isDraging && _this18.lgOpened) {
8324
+ if (isDraging && _this17.lgOpened) {
8304
8325
  isMoved = true;
8305
8326
  endCoords = {
8306
8327
  pageX: e.pageX,
8307
8328
  pageY: e.pageY
8308
8329
  };
8309
8330
 
8310
- _this18.touchMove(startCoords, endCoords);
8331
+ _this17.touchMove(startCoords, endCoords);
8311
8332
 
8312
- _this18.LGel.trigger(lGEvents.dragMove);
8333
+ _this17.LGel.trigger(lGEvents.dragMove);
8313
8334
  }
8314
8335
  });
8315
8336
  $LG(window).on("mouseup.lg.global".concat(this.lgId), function (event) {
8316
- if (!_this18.lgOpened) {
8337
+ if (!_this17.lgOpened) {
8317
8338
  return;
8318
8339
  }
8319
8340
 
@@ -8322,18 +8343,18 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8322
8343
  if (isMoved) {
8323
8344
  isMoved = false;
8324
8345
 
8325
- _this18.touchEnd(endCoords, startCoords, event);
8346
+ _this17.touchEnd(endCoords, startCoords, event);
8326
8347
 
8327
- _this18.LGel.trigger(lGEvents.dragEnd);
8328
- } else if (_this18.isPosterElement(target)) {
8329
- _this18.LGel.trigger(lGEvents.posterClick);
8348
+ _this17.LGel.trigger(lGEvents.dragEnd);
8349
+ } else if (_this17.isPosterElement(target)) {
8350
+ _this17.LGel.trigger(lGEvents.posterClick);
8330
8351
  } // Prevent execution on click
8331
8352
 
8332
8353
 
8333
8354
  if (isDraging) {
8334
8355
  isDraging = false;
8335
8356
 
8336
- _this18.outer.removeClass('lg-grabbing').addClass('lg-grab');
8357
+ _this17.outer.removeClass('lg-grabbing').addClass('lg-grab');
8337
8358
  }
8338
8359
  });
8339
8360
  }
@@ -8341,11 +8362,11 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8341
8362
  }, {
8342
8363
  key: "triggerPosterClick",
8343
8364
  value: function triggerPosterClick() {
8344
- var _this19 = this;
8365
+ var _this18 = this;
8345
8366
 
8346
8367
  this.$inner.on('click.lg', function (event) {
8347
- if (!_this19.dragOrSwipeEnabled && _this19.isPosterElement($LG(event.target))) {
8348
- _this19.LGel.trigger(lGEvents.posterClick);
8368
+ if (!_this18.dragOrSwipeEnabled && _this18.isPosterElement($LG(event.target))) {
8369
+ _this18.LGel.trigger(lGEvents.posterClick);
8349
8370
  }
8350
8371
  });
8351
8372
  }
@@ -8385,7 +8406,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8385
8406
  }, {
8386
8407
  key: "goToNextSlide",
8387
8408
  value: function goToNextSlide(fromTouch) {
8388
- var _this20 = this;
8409
+ var _this19 = this;
8389
8410
 
8390
8411
  var _loop = this.settings.loop;
8391
8412
 
@@ -8410,7 +8431,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8410
8431
  } else if (this.settings.slideEndAnimation && !fromTouch) {
8411
8432
  this.outer.addClass('lg-right-end');
8412
8433
  setTimeout(function () {
8413
- _this20.outer.removeClass('lg-right-end');
8434
+ _this19.outer.removeClass('lg-right-end');
8414
8435
  }, 400);
8415
8436
  }
8416
8437
  }
@@ -8430,7 +8451,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8430
8451
  }, {
8431
8452
  key: "goToPrevSlide",
8432
8453
  value: function goToPrevSlide(fromTouch) {
8433
- var _this21 = this;
8454
+ var _this20 = this;
8434
8455
 
8435
8456
  var _loop = this.settings.loop;
8436
8457
 
@@ -8457,7 +8478,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8457
8478
  } else if (this.settings.slideEndAnimation && !fromTouch) {
8458
8479
  this.outer.addClass('lg-left-end');
8459
8480
  setTimeout(function () {
8460
- _this21.outer.removeClass('lg-left-end');
8481
+ _this20.outer.removeClass('lg-left-end');
8461
8482
  }, 400);
8462
8483
  }
8463
8484
  }
@@ -8466,30 +8487,30 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8466
8487
  }, {
8467
8488
  key: "keyPress",
8468
8489
  value: function keyPress() {
8469
- var _this22 = this;
8490
+ var _this21 = this;
8470
8491
 
8471
8492
  $LG(window).on("keydown.lg.global".concat(this.lgId), function (e) {
8472
- if (_this22.lgOpened && _this22.settings.escKey === true && e.keyCode === 27) {
8493
+ if (_this21.lgOpened && _this21.settings.escKey === true && e.keyCode === 27) {
8473
8494
  e.preventDefault();
8474
8495
 
8475
- if (_this22.settings.allowMediaOverlap && _this22.outer.hasClass('lg-can-toggle') && _this22.outer.hasClass('lg-components-open')) {
8476
- _this22.outer.removeClass('lg-components-open');
8496
+ if (_this21.settings.allowMediaOverlap && _this21.outer.hasClass('lg-can-toggle') && _this21.outer.hasClass('lg-components-open')) {
8497
+ _this21.outer.removeClass('lg-components-open');
8477
8498
  } else {
8478
- _this22.closeGallery();
8499
+ _this21.closeGallery();
8479
8500
  }
8480
8501
  }
8481
8502
 
8482
- if (_this22.lgOpened && _this22.galleryItems.length > 1) {
8503
+ if (_this21.lgOpened && _this21.galleryItems.length > 1) {
8483
8504
  if (e.keyCode === 37) {
8484
8505
  e.preventDefault();
8485
8506
 
8486
- _this22.goToPrevSlide();
8507
+ _this21.goToPrevSlide();
8487
8508
  }
8488
8509
 
8489
8510
  if (e.keyCode === 39) {
8490
8511
  e.preventDefault();
8491
8512
 
8492
- _this22.goToNextSlide();
8513
+ _this21.goToNextSlide();
8493
8514
  }
8494
8515
  }
8495
8516
  });
@@ -8497,13 +8518,13 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8497
8518
  }, {
8498
8519
  key: "arrow",
8499
8520
  value: function arrow() {
8500
- var _this23 = this;
8521
+ var _this22 = this;
8501
8522
 
8502
8523
  this.getElementById('lg-prev').on('click.lg', function () {
8503
- _this23.goToPrevSlide();
8524
+ _this22.goToPrevSlide();
8504
8525
  });
8505
8526
  this.getElementById('lg-next').on('click.lg', function () {
8506
- _this23.goToNextSlide();
8527
+ _this22.goToNextSlide();
8507
8528
  });
8508
8529
  }
8509
8530
  }, {
@@ -8537,20 +8558,22 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8537
8558
  }, {
8538
8559
  key: "mousewheel",
8539
8560
  value: function mousewheel() {
8540
- var _this24 = this;
8561
+ var _this23 = this;
8541
8562
 
8542
8563
  this.outer.on('mousewheel.lg', function (e) {
8543
- if (!e.deltaY || _this24.galleryItems.length < 2) {
8564
+ if (!e.deltaY || _this23.galleryItems.length < 2) {
8544
8565
  return;
8545
8566
  }
8546
8567
 
8547
8568
  if (e.deltaY > 0) {
8548
- _this24.goToPrevSlide();
8549
- } else {
8550
- _this24.goToNextSlide();
8551
- }
8569
+ _this23.goToNextSlide();
8570
+
8571
+ e.preventDefault();
8572
+ } else if (e.deltaY < 0) {
8573
+ _this23.goToPrevSlide();
8552
8574
 
8553
- e.preventDefault();
8575
+ e.preventDefault();
8576
+ }
8554
8577
  });
8555
8578
  }
8556
8579
  }, {
@@ -8572,12 +8595,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8572
8595
  }, {
8573
8596
  key: "toggleMaximize",
8574
8597
  value: function toggleMaximize() {
8575
- var _this25 = this;
8598
+ var _this24 = this;
8576
8599
 
8577
8600
  this.getElementById('lg-maximize').on('click.lg', function () {
8578
- _this25.$container.toggleClass('lg-inline');
8601
+ _this24.$container.toggleClass('lg-inline');
8579
8602
 
8580
- _this25.refreshOnResize();
8603
+ _this24.refreshOnResize();
8581
8604
  });
8582
8605
  }
8583
8606
  }, {
@@ -8592,12 +8615,12 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8592
8615
  }, {
8593
8616
  key: "manageCloseGallery",
8594
8617
  value: function manageCloseGallery() {
8595
- var _this26 = this;
8618
+ var _this25 = this;
8596
8619
 
8597
8620
  if (!this.settings.closable) return;
8598
8621
  var mousedown = false;
8599
8622
  this.getElementById('lg-close').on('click.lg', function () {
8600
- _this26.closeGallery();
8623
+ _this25.closeGallery();
8601
8624
  });
8602
8625
 
8603
8626
  if (this.settings.closeOnTap) {
@@ -8606,7 +8629,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8606
8629
  this.outer.on('mousedown.lg', function (e) {
8607
8630
  var target = $LG(e.target);
8608
8631
 
8609
- if (_this26.isSlideElement(target)) {
8632
+ if (_this25.isSlideElement(target)) {
8610
8633
  mousedown = true;
8611
8634
  } else {
8612
8635
  mousedown = false;
@@ -8618,9 +8641,9 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8618
8641
  this.outer.on('mouseup.lg', function (e) {
8619
8642
  var target = $LG(e.target);
8620
8643
 
8621
- if (_this26.isSlideElement(target) && mousedown) {
8622
- if (!_this26.outer.hasClass('lg-dragging')) {
8623
- _this26.closeGallery();
8644
+ if (_this25.isSlideElement(target) && mousedown) {
8645
+ if (!_this25.outer.hasClass('lg-dragging')) {
8646
+ _this25.closeGallery();
8624
8647
  }
8625
8648
  }
8626
8649
  });
@@ -8641,7 +8664,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8641
8664
  }, {
8642
8665
  key: "closeGallery",
8643
8666
  value: function closeGallery(force) {
8644
- var _this27 = this;
8667
+ var _this26 = this;
8645
8668
 
8646
8669
  if (!this.lgOpened || !this.settings.closable && !force) {
8647
8670
  return 0;
@@ -8659,7 +8682,7 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8659
8682
  var _this$galleryItems$th = this.galleryItems[this.index],
8660
8683
  __slideVideoInfo = _this$galleryItems$th.__slideVideoInfo,
8661
8684
  poster = _this$galleryItems$th.poster;
8662
- var imageSize = lg_utils.getSize(currentItem, this.outer, top + bottom, __slideVideoInfo && !poster, __slideVideoInfo && poster && this.settings.videoMaxSize);
8685
+ var imageSize = lg_utils.getSize(currentItem, this.outer, top + bottom, __slideVideoInfo && poster && this.settings.videoMaxSize);
8663
8686
  transform = lg_utils.getTransform(currentItem, this.outer, top, bottom, imageSize);
8664
8687
  }
8665
8688
 
@@ -8690,32 +8713,32 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8690
8713
  this.$container.removeClass('lg-show-in'); // Once the closign animation is completed and gallery is invisible
8691
8714
 
8692
8715
  setTimeout(function () {
8693
- if (_this27.zoomFromOrigin && transform) {
8694
- _this27.outer.removeClass('lg-zoom-from-image');
8716
+ if (_this26.zoomFromOrigin && transform) {
8717
+ _this26.outer.removeClass('lg-zoom-from-image');
8695
8718
  }
8696
8719
 
8697
- _this27.$container.removeClass('lg-show'); // Need to remove inline opacity as it is used in the stylesheet as well
8720
+ _this26.$container.removeClass('lg-show'); // Need to remove inline opacity as it is used in the stylesheet as well
8698
8721
 
8699
8722
 
8700
- _this27.$backdrop.removeAttr('style').css('transition-duration', _this27.settings.backdropDuration + 'ms');
8723
+ _this26.$backdrop.removeAttr('style').css('transition-duration', _this26.settings.backdropDuration + 'ms');
8701
8724
 
8702
- _this27.outer.removeClass("lg-closing ".concat(_this27.settings.startClass));
8725
+ _this26.outer.removeClass("lg-closing ".concat(_this26.settings.startClass));
8703
8726
 
8704
- _this27.getSlideItem(_this27.index).removeClass('lg-start-end-progress');
8727
+ _this26.getSlideItem(_this26.index).removeClass('lg-start-end-progress');
8705
8728
 
8706
- _this27.$inner.empty();
8729
+ _this26.$inner.empty();
8707
8730
 
8708
- if (_this27.lgOpened) {
8709
- _this27.LGel.trigger(lGEvents.afterClose, {
8710
- instance: _this27
8731
+ if (_this26.lgOpened) {
8732
+ _this26.LGel.trigger(lGEvents.afterClose, {
8733
+ instance: _this26
8711
8734
  });
8712
8735
  }
8713
8736
 
8714
- if (_this27.outer.get()) {
8715
- _this27.outer.get().blur();
8737
+ if (_this26.outer.get()) {
8738
+ _this26.outer.get().blur();
8716
8739
  }
8717
8740
 
8718
- _this27.lgOpened = false;
8741
+ _this26.lgOpened = false;
8719
8742
  }, removeTimeout + 100);
8720
8743
  return removeTimeout + 100;
8721
8744
  }
@@ -8801,21 +8824,21 @@ var lightgallery_LightGallery = /*#__PURE__*/function () {
8801
8824
  }, {
8802
8825
  key: "destroy",
8803
8826
  value: function destroy() {
8804
- var _this28 = this;
8827
+ var _this27 = this;
8805
8828
 
8806
8829
  var closeTimeout = this.closeGallery(true);
8807
8830
  setTimeout(function () {
8808
- _this28.destroyModules(true);
8831
+ _this27.destroyModules(true);
8809
8832
 
8810
- if (!_this28.settings.dynamic) {
8811
- _this28.invalidateItems();
8833
+ if (!_this27.settings.dynamic) {
8834
+ _this27.invalidateItems();
8812
8835
  }
8813
8836
 
8814
- $LG(window).off(".lg.global".concat(_this28.lgId));
8837
+ $LG(window).off(".lg.global".concat(_this27.lgId));
8815
8838
 
8816
- _this28.LGel.off('.lg');
8839
+ _this27.LGel.off('.lg');
8817
8840
 
8818
- _this28.$container.remove();
8841
+ _this27.$container.remove();
8819
8842
  }, closeTimeout);
8820
8843
  return closeTimeout;
8821
8844
  }