biati-digital / glightbox

Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
MIT License
2.03k stars 228 forks source link

Anchor link within inline content #380

Closed onetrev closed 1 year ago

onetrev commented 1 year ago

Describe the bug I'm trying to put an anchor link inside a glightbox. It seems like it should be simple and just work (what's simpler than an anchor / hash link right?), but unfortunately clicking on the anchor link does nothing. Bug or just something I'm not doing right? Happy to be told it's the latter. :)

gingerchew commented 1 year ago

Hey there @onetrev

You need to post a code example for us to be able to tell if it's a bug or an error on your part.

I do recommend adding this to the discussions, though. We can't offer implementation help, because of our issues policy and our general workload at our respective jobs. Discussions is a good way to get help from others, or see other examples.

onetrev commented 1 year ago

Hi @gingerchew, thanks so much for the follow up! Sorry I didn't post any code, that was terribly rude of me. But to make up for that I have a full page demonstrating the issue. It's a plain HTML page, nothing but Glightbox on it, so there is nothing else interfering.

You can click to open the modal, there is a anchor link in the modal. Clicking on that does nothing. Which is exactly what I'm seeing on the local site I have this issue on.

And yes, very good point about the Discussions area. I keep forgetting Github added that a little while back. I'm happy to move this over there, but I'll wait until you get a chance to take a quick look at it as it seems like a good chance this is a bug. :)

gingerchew commented 1 year ago

Ahhhhh I see what you're trying to do now. That is actually an HTML quirk, not a bug so much.

Since GLightbox copies the HTML in the "advanced description" slides, there are now two #anchor-point headings.

You can't scroll to two different headings at the same time, even if one of them is completely hidden with CSS.

Good news, it can be patched/un-quirked with a little bit of JS and some event handling. I can post my solution in a discussions thread later today and be sure to tag you.

onetrev commented 1 year ago

Cool, thank you! Sounds like this is not a bug then, as I suspected it wasn't.

I'm not sure if you wanted me to start the discussion thread first, but I did anyway just now and will close this issue. Looking forward to seeing the fix, but no rush, I appreciate it whenever you can get to it.