Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Aiheen aloitti: fullmoonya - tammikuu 06, 2012, 01:45:24 AP

Otsikko: vb style menu mod(request)
Kirjoitti: fullmoonya - tammikuu 06, 2012, 01:45:24 AP
hi to all. i would like to request a mod for the main menu of smf that when a user clicks on the top button, the submenus under it will appear and will close if the user's cursor clicked on somewhere in the page or in other menu buttons of the forum. i hope someone could help me with this. if this is already made, what is the name of that mod? i tried to look for it but seems no mod like that yet. please help me. thank you in advance.
Otsikko: Re: vb style menu mod(request)
Kirjoitti: kat - tammikuu 06, 2012, 07:58:10 AP
Define "Top button".

The "Moderate Profile My Messages Calendar Members Logout" buttons already do that, except they don't need clicking. So, I guess you don't mean those.

Or, do you mean you want that to be the same, but need to be clicked on, before the sub-menu appears?
Otsikko: Re: vb style menu mod(request)
Kirjoitti: fullmoonya - tammikuu 06, 2012, 07:38:20 IP
Lainaus käyttäjältä: K@ - tammikuu 06, 2012, 07:58:10 AP
Define "Top button".

The "Moderate Profile My Messages Calendar Members Logout" buttons already do that, except they don't need clicking. So, I guess you don't mean those.

Or, do you mean you want that to be the same, but need to be clicked on, before the sub-menu appears?

top button - the buttons of main menu containing the sub menu buttons.

yes. i want it to be the same but needs to be clicked on before the sub menu appears. can you help me with this sir? i just need this type of menu for my forum. :(
Otsikko: Re: vb style menu mod(request)
Kirjoitti: Antechinus - tammikuu 06, 2012, 10:44:34 IP
I did this a while back using one of Stu Nicholls' scripts (http://www.stunicholls.com/menu/simple.html). This wont close the sub-menus if you just click anywhere outside them. You have to click on one (any one) of the top level buttons to close any sub-menu.

It would need some slight modification for 2.0. If you want working on all menus (including inside profile, admin, etc) you'd need to call the menu by class rather than by ID.

The following should work in click_menu.js. Find:

clickMenu = function(menu) {
var getEls = document.getElementById(menu).getElementsByTagName("LI");
var getAgn = getEls;


Replace:

clickMenu = function(menu) {
var getEls = document.getElementByClassName(dropmenu).getElementsByTagName("LI");
var getAgn = getEls;


With the following changes in index.template.php. Find:

<body>

Replace:

<body onload="clickMenu(\'menu\')">

Note that this wont work in Internet Explorer though, because IE (being a retarded POS as usual) doesn't support getElementByClassName. You can try the method mentioned in the second answer here (http://stackoverflow.com/questions/900117/is-getelementbyclass-safe-to-use-across-browsers-like-getelementbyid).

Really, if you want it working in all browsers you might as well go with jQuery and a custom function.
Otsikko: Re: vb style menu mod(request)
Kirjoitti: fullmoonya - tammikuu 07, 2012, 05:03:11 AP
sir ant, maybe i'll use jquery for this. but what code to be use and where i can put those codes to make this happen?  :'(