I have a text element on a page, like this:
I’m trying to find a way that I can give users definitions of the underlined words. Best thing would be that when a user hovers over or clicks on an underlined word a lightbox or modal box opens up with the definition in it.
I can set the words up with an tag that can open a lightbox. If I was opening the lightbox from a button I could send data to it, and using the data I could put the word and definition into the lightbox. But there seems to be no way to send data to a lightbox using a url. I’ve tried:
<a href="/my-lightbox?word=consectetur"><span style="border-bottom: 1px dotted #000;">consectetur</span></a>
but the queryparam doesn’t seem to get passed to the lightbox (at least, I can’t find a way to retrieve it). I understand that the lightbox isn’t a page (but that should make it easier to get data to it).
I’ve tried using an html onclick() function on the word, but Wix doesn’t support this.
I’ve tried to work out whether I can use the onClick() event of the text element to identify the word that was clicked on, but there doesn’t seem to be a way to identify anything other than the xy coordinates of the click (nor does there seem to be a way to retrieve a selected word in a text element).
Any idea how this could be achieved?