forums
You are not logged in.
I am able to initiate menus using the inner html example in another post, however I have been unable to format the menus if the they are not declared before c_smartmenus.js. I bring the menus in to the page using ajax so I dont know their id's before then come in. Is there a way to declare them before I initiate them? I tried coping the properties by doing
c_menus['mynewmenu']=c_menus['Menu1'];
this works in the header berfore c_smartmenus.js but does not work even if I put before
c_M=0; // these are the lines you need
c_mN(); // these are the lines you need
Thanks in advance
Oak
Offline
Unfortunately, with the original SmartMenus code, the ids of all main menus must be included in "c_config.js" (or declared before "c_smartmenus.js"). The ids are used by the script for generating the CSS for the menus and also for their initialization.
What comes to my mind is one solution which could work if you at least could get all the possible main menu ids easily (and if they are not too many to cause a performance issue). Normally, the script allows declaring menu trees in "c_config.js" that actually do not exist on the current page. If there are such non-existent menus on the current page declared, the script would simply neglect these declarations and not produce any errors. However, it still generates some crucial CSS for such menus during page load (at a point when it can't detect whether the declared menus actually exist on the page) so such declarations still affect a bit performance and it's not a good idea to have too many of them in the configuration file (e.g. more than 25-30).
So what you could possibly do is make the configuration file dynamic (e.g. "c_config.asp", "c_config.php" or whatever server side language you use) and generate declarations for all the possible main menu ids.
Otherwise, the SmartMenus core code would need to be quite customized in order to work in a different way.
Offline
Understood, the only real problem is the menus show verticle based on your explenation I see 2 solutions.
I could have each menu have 1 top level say "Tools" and the rest be sub and it would format fine without being declared (I believe)
2. I could predefine a number of menus and hope to not over rund the available configurations.
I assume as site admin you are the author. Very well done!!
Thanks
Oak
Offline