SmartMenus DHTML Menu / JavaScript Menu - Forums

forums

You are not logged in.

#1 2011-Nov-23 12:46:39

Kofl
Member
Registered: 2009-Nov-05
Posts: 10

Sub-menu as wide as main menu

Hello,

I tried to tweak the configuration, but so far I was not able to force the submenu (1 level) to be as wide as the main menu width.

Has anyone an idea, that would be great.

Thanks a lot,
Thomas

Offline

 

#2 2011-Nov-24 08:55:23

smartmenus
Site Admin
From: Plovdiv, BULGARIA
Registered: 2003-Feb-23
Posts: 1109
Website

Re: Sub-menu as wide as main menu

Hi Thomas,

I replied to you by email on November 22nd, but I guess you haven't received my email so I just resent it.

Anyway, just in case I am going to post the solution here too - to achieve this you would need a small modification. For the purpose just include the following small add-on script after the link to the SmartMenus script core file "c_smartmenus.js" on the page - i.e.:

Code:

// make the first-level sub menus' width match the parent item's width
old_sH = c_sH;
c_sH = function(u) {
    if (u.LV == 2) {
        var s = c_styles[u.className][0];
        u.style.width = c_gD(u.parentNode) - (c_oM ? 0 : s[0] * 2 + s[3] * 2) + 'px';
    }
    old_sH(u);
}

In your specific case, I also did just one additional thing - I set the following in the last section of the configuration file "c_config.js":

Code:

// MAIN-MENU FEATURES
...
-10,        // X SubMenuOffset (pixels)

to make sure the first-level sub menus are aligned correctly.

Please let me know if you have any questions.

Thanks!


-Vasil Dinkov-

Offline

 

Board footer

Powered by FluxBB