Utilizing a ddsmoothmenu involves dynamically adding a class name to the parent menu container through the plugin. Once applied, all CSS rules will also affect the menu. Below is an example of how the classname is passed:
<div id="myMenu">
<ul>
<li>.....</li>
</ul>
</div>
The following code snippet demonstrates how the classname is dynamically added to the menu container by the plugin:
ddsmoothmenu.init({
mainmenuid: 'myMenu',
orientation: 'h',
classname: 'ddsmoothmenu',
contentsource: 'markup'
});
However, I encountered a challenge when trying to add a 'noindex' class to the menu container. The plugin replaced my class with whatever was provided in the 'classname' parameter above.
Specifically, this line within the plugin causes the issue:
$mainmenu.parent().get(0).className = setting.classname || "ddsmoothmenu"
In this context, $mainmenu
refers to the unordered list element.
I considered using the simple += operator to concatenate classnames, but I'm unsure if that would work due to the ternary if..else setup in the code.
Is it possible to modify the line as follows:
$mainmenu.parent().get(0).className += setting.classname || "ddsmoothmenu"
?
I aim to retain the hardcoded class in the markup while allowing the plugin-generated class to be appended to it.