dimsemenov / photoswipe-dynamic-caption-plugin

A dynamic caption plugin for PhotoSwipe v5. Automatically positions the caption aside or below the image.
MIT License
65 stars 12 forks source link

Option to remove zoom animation from captions #23

Closed artneo7 closed 3 months ago

artneo7 commented 3 months ago

Hello! Let me start by saying thanks for the awesome lib! 🏆

Is there a way to disable the zoom animation only for captions? showHideAnimationType: 'zoom'

remove-zoom-caption-animation

dimsemenov commented 3 months ago

This can happen if you have data-cropped="true" due to how it works. There is no option to disable it for now unless you hide the caption initially and display it only after the gallery is fully opened.

artneo7 commented 3 months ago

reduced-caption-animation

I found out a good solution, you just need to add the following custom CSS to photoswipe-dynamic-caption-plugin.css

.pswp__dynamic-caption {
  color: #fff;
  position: absolute;
  width: 100%;
  left: 0;
  top: 0;
  /* transition: opacity 120ms linear !important; */
  /* comment out this declaration */
}
.pswp__item div.pswp__dynamic-caption {
  opacity: 0;
  transition: opacity 125ms;
  transition-delay: 350ms;
}
.pswp--ui-visible .pswp__item div.pswp__dynamic-caption {
  opacity: 1;
}
.pswp__item:not(.pswp--ui-visible .pswp__item) div.pswp__dynamic-caption {
  opacity: 0;
  transition: opacity;
}