PhotoSwipe icon indicating copy to clipboard operation
PhotoSwipe copied to clipboard

added natural image height and width without defined it with data-psw…

Open spoitler opened this issue 1 year ago • 3 comments

The data-pswp-width and data-pswp-height still working, but now it is optional.

before

<ul id="my-gallery">
  <li>
    <a href="https://..." data-pswp-width="1669" data-pswp-height="2500" target="_blank">
      <img src="https://..." alt="" loading="lazy">
    </a>
  </li>
</ul>

after

<ul id="my-gallery">
  <li>
    <a href="https://..." target="_blank">
      <img src="https://..." alt="" loading="lazy">
    </a>
  </li>
</ul>

spoitler avatar Jul 11 '23 14:07 spoitler

I'm not sure that relying on thumbnail dimensions is a good idea, especially as a default behavior. The domItemData filter allows you to do this without modifying the lib.

dimsemenov avatar Jul 13 '23 05:07 dimsemenov

I think setting the default width and height is a good idea. Once the width and height preview is not set, there will be problems. Setting the default width and height can be used as a compatibility solution

otary avatar Aug 01 '23 02:08 otary

Yes, this is not a big problem. Both data-pswp-width and data-pswp-height can be dynamically assigned after the image is loaded.

pxp1230 avatar Aug 19 '23 05:08 pxp1230