mardi 5 mai 2020

How to scroll to an image link on another page

I need to scroll down to an image when clicking on an href.

Ideally, we would do

<a href="https://example.org#https://example.org/image.png">foo</a>

and the user who clicks on the link would automatically get scrolled down on the image on the page.

Sadly, it doesn't work that way. There isn't always an id for an image and we are currently not storing it with the link of the image.

One solution would be to create a service that searches for the image on the page and returns the closest div/id from the image but I was wondering if there was another solution ?




Aucun commentaire:

Enregistrer un commentaire