Anchoring to an accordion


(Natalie) #1

Matrix Version:

How can I generate a URL that directs to an anchor in an accordion? Is this possible?

More context: We have an accordion that contains stories and we want to be able to link from our newsletter directly to one of these stories.

Help appreciated!


(John gill) #2

Not a Matrix issue, it’ll depend on whether the accordion you’re using supports it - and they usually don’t.

When they do, this is generally achieved by using link anchors, e.g example.com/a/b#item2

Sometimes accordions add identifiers to each item and you can use that identifier to open the corresponding item. Less often the accordion will open an item if you link to an anchor identifier which is contained inside that item.


(Nick Papadatos) #3

Hello,

I was able to achieve this by using JS. Clicking on a link / anchor triggers a click event to the tab containing the anchor then scroll down to it. Does that sound doable? Happy to help if your accordion supports it as John pointed out