Hey,
I'm trying to create a menu in the header, that menu has submenu, but I also want it to be a link.
the menu item have to be link, and also in the submenu we have to use link.
can look at demo 35:
https://preview.keenthemes.com/metronic8/demo35/
that the menu items in header is not link, only the sub menu items.
Hey Sean,
I'm relating to my co-workers question, Your solution did help but it only works on 'hover' trigger, if I am to add a 'click' trigger too, it's impossible to open the submenu accordion.
currently I added the hover trigger to lg breakpoint, but in mobile you're doomed to use click, which makes it so the accordion won't open, I know why it happens so I'm willing to add the click trigger to the menu-arrow but you're still stuck with "A" tag that wraps but menu-link element.
edit: found a solution, added to your solution is JS:
if (element.hasAttribute("href") && !e.target.classList.contains("menu-arrow")) {
return;
}
Hi,
At the moment this feature is not supported and we will add it in the next update. To enable this you will need to do a small change in src/js/components/menu.js
and add a condition element.hasAttribute('href')
as shown below:
// Event Handlers
// Toggle handler
var _click = function(element, e) {
if (element.hasAttribute("href") ) {
return;
}
e.preventDefault();
if (the.disabled === true) {
return;
}
var item = _getItemElement(element);
if ( _getOptionFromElementAttribute(item, "trigger") !== "click" ) {
return;
}
if ( _getOptionFromElementAttribute(item, "toggle") === false ) {
_show(item);
} else {
_toggle(item);
}
}
<a href="#%22%20class=%22menu-link" target="_blank" rel="noopener noreferrer">
...
</a>
Thank you!
Hi,
You are welcome! Please let us know if it worked well. If you need any further help just ping us here.
Regards.
It helped, and worked
sorry for delay, didnt see your comment
Great! All the best with your project!