Alex Trofimov 1 год назад
Родитель
Сommit
18308c1b0e
1 измененных файлов с 15 добавлено и 6 удалено
  1. 15 6
      inc/js/classes/BxDolCmts.js

+ 15 - 6
inc/js/classes/BxDolCmts.js

@@ -64,12 +64,7 @@ BxDolCmts.prototype.cmtInit = function()
         $this._cmtsInitSeeMore($($this._sRootId));
 
         // init gallery
-        const lightbox = new PhotoSwipeLightbox({
-            gallery: '.pswp-gallery',
-            children: 'a',
-            pswpModule: PhotoSwipe,
-        });
-        lightbox.init();
+        $this._cmtsInitGallery($($this._sRootId));
     });
 };
 
@@ -808,6 +803,7 @@ BxDolCmts.prototype._getCmt = function (e, iCmtId)
                     $(this).hide().html(oData.content).bxProcessHtml().bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
 
                 $this._cmtsInitSeeMore($(this));
+                $this._cmtsInitGallery($(this));
             });
         },
         'json'
@@ -886,6 +882,7 @@ BxDolCmts.prototype._cmtsReplace = function(oReplace, sContent, onLoad)
             $this._cmtsBlink($(this));
 
             $this._cmtsInitSeeMore($(this));
+            $this._cmtsInitGallery($(this));
 
             if(typeof onLoad == 'function')
                 onLoad();
@@ -901,6 +898,7 @@ BxDolCmts.prototype._cmtsReplaceContent = function(oParent, sContent, onLoad)
             $this._cmtsBlink($(this));
 
             $this._cmtsInitSeeMore($(this));
+            $this._cmtsInitGallery($(this));
 
             if(typeof onLoad == 'function')
             onLoad();
@@ -919,6 +917,17 @@ BxDolCmts.prototype._cmtsBlink = function(oParent)
     });
 };
 
+BxDolCmts.prototype._cmtsInitGallery = function(oParent) 
+{
+    // init gallery
+    const lightbox = new PhotoSwipeLightbox({
+        gallery: '.pswp-gallery',
+        children: 'a',
+        pswpModule: PhotoSwipe,
+    });
+    lightbox.init();
+}
+
 BxDolCmts.prototype._cmtsInitSeeMore = function(oParent)
 {
     var $this = this;