The code snippet of PhotoSwipe + Swiper integration. Works for both looped and non-looped sliders.
- Create
libs/photoswipe/photoswipe-swiper.js
- Import the created file in the
libs/photoswipe/photoswipe.js
and exportinitPhotoSwipeWithSwiper
function - Init PhotoSwipe on the .swiper-wrapper element
Note: You can include libs/photoswipe/photoswipe.js
and use both initPhotoSwipeFromDOM()
and initPhotoSwipeWithSwiper()
functions; or include only libs/photoswipe/photoswipe-swiper.js
if you don't need default PhotoSwipe initializer.