Trigger offcanvas by click on standard button element

Hello,

I’m using the 1.8 beta and trying out the offcanvas element. However, I can’t figure out how to trigger the offcanvas element using another element than the trigger element. I want to trigger it via a standard button element. Is this possible at the moment?

Sure.

Use button element design as you need.

Assign class .brxe-toggle, then add attributes: aria-label=“Open” aria-expanded=“false”, data-selector=“#offcanvas_id”.

Then you should be good to go.

2 Likes

Thanks a lot Martin, this works a treat! Guess I was to lazy to inspect the code myself :smiley:

Hopefully this will be implemented in the same way popups can be triggered from an interaction.

Is it possible if can you share screenshot where exactly, put all those class and attributes?

1 Like

Te paso capturas de como hacerlo.

1) Añadir la clase .brxe-toggle al elemento que quires que abra el Off Canvas(Assign class .brxe-toggle)

Como podes ver es añadir una clase al elemento que deseas que abra el offcanvas

2) Añadir los atibutos al elemento que quieres que abra el Off Canvas (add attributes: aria-label=“Open” aria-expanded=“false”, data-selector=“#offcanvas_id”.)
IMG 2

IMPORTANTE
el data-selector es el ID que tiene tu OffCanvas eso lo podes cambiar acá

IMG3

poner sin #

2 Likes

IMG2

IMG 3

Hello, I would like to ask for your help, I am trying to replicate this action, but it does not work for me, I am sending screenshots, greetings

data-selector = #detalle{echo:get_the_id()}
aria-label = open
aria-expanded = false

css id = #detalle{post_id}

Hi, assign an ID to your Offcanvas element and add it in the value field you see in IMG2