somewebmedia/hc-offcanvas-nav

"Uncaught TypeError: Nav.close is not a function"

Closed this issue · 2 comments

I'm using this wonderful plugin, Thank you for the great work
the menu works perfect except one thing:
For some reason I can't use the basic events like open() or close() , whenever I try, I'm getting the above ERROR and I can't figure out what's wrong : /

Example of my problem (here the alert is not fired on menu open/toggle event):
https://codepen.io/meidanmor/pen/vYZPLNO

Thank you again! I really like this menu and I hope we can fix this..

by the way, I tried to create the menu with Vanila JS and I have an ERROR:
"Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
at j (VM873 hc-offcanvas-nav.min.js:17)
at n (VM873 hc-offcanvas-nav.min.js:17)
at new i (VM873 hc-offcanvas-nav.min.js:17)"

You can't get the reference to the Nav object like that when using jQuery.

Code from here:

var $nav = $('#main-nav').hcOffcanvasNav();
var Nav = $nav.data('hcOffcanvasNav');

@somewebmedia
Thank you so much for the fast answer!
the easiest things is always the hardest for me to figure haha :]
I updated my pen to help some other users..