vmitsaras / js-offcanvas

A lightweight, flexible jQuery off-canvas navigation plugin which lets you create fully accessible sidebar or top/bottom sliding (or push) panels with keyboard interactions and ARIA attributes.
http://codepen.io/vmitsaras/pen/gwGwJE
MIT License
270 stars 30 forks source link

Uncaught TypeError: Cannot read property 'addEventListener' of undefined #46

Closed facine closed 5 years ago

facine commented 5 years ago

Hi, thanks for this great plugin!

I'm trying to develop a Drupal contrib module and I get this error only using reveal, with overlay and push works fine.

This works: `<a class="js-offcanvas-trigger" data-offcanvas-trigger="off-canvas-id" href="#off-canvas">Menu</a>

<div class="js-offcanvas" data-offcanvas-options='{"modifiers": "right,push"}' id="off-canvas-id">...</div>`

This isn't work: `<a class="js-offcanvas-trigger" data-offcanvas-trigger="off-canvas-id" href="#off-canvas">Menu</a>

<div class="js-offcanvas" data-offcanvas-options='{"modifiers": "right,reveal"}' id="off-canvas-id">...</div> `

Error message js-offcanvas.pkgd.js?v=1.x:89 Uncaught TypeError: Cannot read property 'addEventListener' of undefined at Object.utils.onEndTransition (js-offcanvas.pkgd.js?v=1.x:89) at window.componentNamespace.Offcanvas.Offcanvas.open (js-offcanvas.pkgd.js?v=1.x:591) at window.componentNamespace.Offcanvas.Offcanvas.toggle (js-offcanvas.pkgd.js?v=1.x:692) at toggleOffcanvas (js-offcanvas.pkgd.js?v=1.x:857) at HTMLAnchorElement. (js-offcanvas.pkgd.js?v=1.x:56) at HTMLAnchorElement.dispatch (jquery.min.js?v=3.2.1:3) at HTMLAnchorElement.q.handle (jquery.min.js?v=3.2.1:3)

Any idea? Thanks!

vmitsaras commented 5 years ago

HI @facine , did you added the offcanvas.css with the reveal css-classes?

facine commented 5 years ago

Yes @vmitsaras, these are the loaded files:

Captura de pantalla 2019-09-17 a las 15 13 36

And this other de HTML code after open/close the push & reveal elements: 61kce8ych1no8lt33yep

And these are the reveal errors: Captura de pantalla 2019-09-17 a las 15 15 38

facine commented 5 years ago

There wasn't any c-offcanvas-content-wrap, sorry.

after add the wrapper it works fine.

thanks.