flexanalytics / plugin-image-zoom

MIT License
67 stars 13 forks source link

Zoom doesn't work if image is wrapped within a #9

Open alewolf opened 2 years ago

alewolf commented 2 years ago

The zoom doesn't work if the image is wrapped in a <details> tag.

The magnifying glass 🔎 shows up when I hover over the image, that means the image is detected by the selector, but when I click it, the image doesn't zoom.

You can find a demo here: https://sweetcode.com/docs/wpm/plugin-configuration/google-analytics

7yfo9 2022-02-21 07-04-52

It works fine if I don't wrap it in a <details> tag.

Is there a way to fix this?

ataft commented 2 years ago

I was able to replicate the issue and fix it by changing the themeConfig.zoomSelector (now themeConfig.imageZoom.selector). I changed my config from zoomSelector: '.markdown :not(em) > img' to zoomSelector: '.markdown img'. However, I'm not sure what was causing the issue, or why that fixed it. It could be an issue with the underlying medium-zoom plugin.

alewolf commented 2 years ago

I should have mentioned this. I am already using zoomSelector: '.markdown img' and it is still not working in my case. Something must be different in your install.