File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed
Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -1147,18 +1147,20 @@ lightGallery(document.querySelector('.medium-zoom-demo'), {
11471147
11481148
11491149let $lgSwiper = document . getElementById ( 'lg-swipper' ) ;
1150- const swiper = new Swiper ( '.swiper' , {
1151- // other parameters
1152- navigation : {
1153- nextEl : '.swiper-button-next' ,
1154- prevEl : '.swiper-button-prev' ,
1155- } ,
1156- on : {
1157- init : function ( ) {
1158- const lg = lightGallery ( $lgSwiper ) ;
1159- $lgSwiper . addEventListener ( 'lgBeforeClose' , ( ) => {
1160- swiper . slideTo ( lg . index , 0 )
1161- } ) ;
1150+ if ( $lgSwiper ) {
1151+ const swiper = new Swiper ( '.swiper' , {
1152+ // other parameters
1153+ navigation : {
1154+ nextEl : '.swiper-button-next' ,
1155+ prevEl : '.swiper-button-prev' ,
11621156 } ,
1163- }
1164- } ) ;
1157+ on : {
1158+ init : function ( ) {
1159+ const lg = lightGallery ( $lgSwiper ) ;
1160+ $lgSwiper . addEventListener ( 'lgBeforeClose' , ( ) => {
1161+ swiper . slideTo ( lg . index , 0 ) ;
1162+ } ) ;
1163+ } ,
1164+ } ,
1165+ } ) ;
1166+ }
You can’t perform that action at this time.
0 commit comments