Skip to content

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

Open
spoitler wants to merge 2 commits into
dimsemenov:masterfrom
spoitler:master
Open

added natural image height and width without defined it with data-psw…#2048
spoitler wants to merge 2 commits into
dimsemenov:masterfrom
spoitler:master

Conversation

@spoitler

Copy link
Copy Markdown

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>

@dimsemenov

Copy link
Copy Markdown
Owner

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.

@otary

otary commented Aug 1, 2023

Copy link
Copy Markdown

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

@pxp1230

pxp1230 commented Aug 19, 2023

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants