I am using a ddsmoothmenu, and it is constructed in such a way that a class name can be dynamically added to the parent menu container via the plugin, and once the class is applied to the parent container, all css will also apply on the menu. Here is how the ddsmoothmenu is passing classname:
<div id="myMenu">
<ul>
<li>.....</li>
</ul>
</div>
And the rendering of the menu is done by the following, where the 'classname' is being passed via the plugin to be added dynamically to the menu container.
ddsmoothmenu.init({
mainmenuid: 'myMenu',
orientation: 'h',
classname: 'ddsmoothmenu',
contentsource: 'markup'
});
So far so good. But I need to add a 'noindex' class to the menu container. I thought it's easy I will simply add in the markup, but the problem is the plugin replaces my class and add whatever is supplied from the above 'classname' parameter.
In the plugin itself: this line of code is the culprit:
$mainmenu.parent().get(0).className = setting.classname || "ddsmoothmenu"
where $mainmenu is basically the unordered list.
I know I can do a simple += to concatenate classnames. But I am not sure if that is possible in the above as it has the ternary if..else setup
Can I do $mainmenu.parent().get(0).className += setting.classname || "ddsmoothmenu"
I want something like the above line so that the class that I have hard coded in the markup gets to stay while the one added by the plugin simply gets appended to the class I have added directly in the markup?
$mainmenu.parent().get(0).className += setting.classname || "ddsmoothmenu"I know this may not be syntactically correct, you know what I am going for..