diff options
author | rochefort <terasawan@gmail.com> | 2021-08-24 04:29:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 04:29:01 +0300 |
commit | 951b0ad3c60ee2220de42cd5ddf1bff3fe2813c5 (patch) | |
tree | a98d1f816be7a0e4e5af71be42eaa50caad18041 | |
parent | 72e1a9d03fdab80c2527a07c915422efe2384f48 (diff) |
fix: exclude medium-zoom for img tags directly under a tag (#346)
-rw-r--r-- | layouts/partials/third-party/medium-zoom.html | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/layouts/partials/third-party/medium-zoom.html b/layouts/partials/third-party/medium-zoom.html index b46dbb0..c9f59e6 100644 --- a/layouts/partials/third-party/medium-zoom.html +++ b/layouts/partials/third-party/medium-zoom.html @@ -1,7 +1,10 @@ <script src="https://cdn.jsdelivr.net/npm/medium-zoom@latest/dist/medium-zoom.min.js"></script> <script> - mediumZoom(document.querySelectorAll('div.post-body img'), { + let imgNodes = document.querySelectorAll('div.post-body img'); + imgNodes = Array.from(imgNodes).filter(node => node.parentNode.tagName !== "A"); + + mediumZoom(imgNodes, { background: 'hsla(var(--color-bg-h), var(--color-bg-s), var(--color-bg-l), 0.95)' }) </script> |