Closed maddorris closed 3 years ago
Update - it's not a bug its a feature: insertClose: 0 solves the issue =)
One question i have - is it possible to open menu on current active page level and not each time from start?
Thanks.
Yes, check the data-nav-active
attribute.
If you're using WordPress I've wrote a out of the box working code.
Thank you. Ill check on this. Im Working basicaly with joomla, but i think i will get this working =)
Unfortunately it didnt work for me. so i was able to add data-nav-active to last active li-element, but it still open from start. So my structure is now like
<ul>
<li>menu 1<7li>
<li> menu 2
<ul>
<li data-nav-active>Menu 2.1</li>
</ul>
</li>
</ul>
May it be an issue adding this data attribute via jQuery and not directly in code?
$(function(){ $('ul.menu li.active').last().attr('data-nav-active',''); });
Any help is very appreciated =)
Try it like this:
<ul>
<li>menu 1<7li>
<li data-nav-active> menu 2
<ul>
<li>Menu 2.1</li>
</ul>
</li>
</ul>
And if you're using jQuery to add the attribute, be sure to add it before initiating the Nav.
Hi, thanks for advise, but unfortunately this didnt woked for me.
I did tryed to add data-nav-active to current active li, to his ul-parent or to ul-li-parent - all of this didnt worked.
I did checked hc-offcanvas-nav.js and didnt found any implementation for data-nav-active and data-nav-highlight. Can it be this is not inplace in git-version? Cause id did tryed same on your demo also and wasn't lucky as well...
Thanks for your support.
I've just noticed how you are using jQuery attr()
to add attribute. You must use it like this .attr('data-nav-active', true)
I do it like:
$("#main-nav ul.menu li.active.parent:last").attr("data-nav-active","");
And adding this attribute works very well. But it doesnt affect how the nav is working.
So, have you tried using the true
instead of ''
?
This doesnt help. What i noticed - your script create a clone of original navigation and hide the origin one. So i have two navs - hidden and one created by script. In origin i see all by system or via script added attributes and Id's. In cloned nav all these are missing. I gues this is the reason why it doesnt work.
Hovever i cant add id or data attributes to cloned nav, cause i have to do it before it will be initialized, as you told.
Thank you
In cloned nav all these are missing. I gues this is the reason why it doesnt work.
Nope this is as it should be. Something else is troubling you.
I've just checked the data attributes with the repository demo and everything works as expected. So in order to help you, you would have to provide me with some demo I can live test.
did send you via mail.
For anyone reading, the problem was caused by the usage of the much older version of the plugin.
Hi,
one small issue i can't fix - close button appearing on the second place right after Home menu link. Do you have probably any idea what could cause it?
Nav title
Home
Close
Other nav item
etc
Back button after you click deeper is then on the right place.
Thanks in advance for any support.