简体   繁体   中英

Typo3 dropdown menu destroys itself on specific site on specific level

I've created a dropdown menu in TS with following code:

TS:

MAIN_MENU = HMENU
MAIN_MENU {
    entryLevel = 0
    1 = TMENU
    1 {
        expAll = 1
        # Always output all childs, hide/unhide them with JS
        wrap = <ul>|</ul>

        # Normal state properties
        NO.wrapItemAndSub = <li>|</li> |*| <li>|</li> |*| <li class="last">|</li>

        # Enable active state and set properties:
        ACT < .NO
        ACT = 1
        ACT.ATagParams = class="activelink"
        ACT.wrapItemAndSub = <li class="active">|</li>
    }

    2 = TMENU
    2 {
        wrap = <div class="scnd_menu"><ul>|</ul></div>
        NO.allWrap = <ul id="scnd_menu_wrapper"><li><ul class="menu_secondLevel"><li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || </ul></li><li><ul class="menu_secondLevel"><li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || </ul></li><li><ul class="menu_secondLevel"><li>|</li> || <li>|</li> |*||*|
        ACT < .NO
        ACT = 1
        ACT.ATagParams = class="activelink"
        ACT.allWrap = <li class="active">|</li>
    }
}

CSS:

    /* Main Menu */
#menu_main {
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top:  45px;
    margin-bottom: 10px;
}
#menu_main ul {
    list-style: none;
}
#menu_main ul li {
    float: left;
    margin-bottom: 0;
    margin-left: 25px;
}

#menu_main ul li.active a {
    color: #AF0008;
}
#menu_main ul li a {
    color: #2c211a;
    width: 100%;
    text-align: center;
    display: block;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 5px;
    padding-right: 5px;
}
#menu_main ul li a:hover {
    text-decoration: none;
    color: #AF0008;
    background-color: #F1DED7;
}
#menu_main ul li:hover .scnd_menu, #menu_main ul li:hover ul.menu_secondLevel, #menu_main ul li:hover ul.menu_secondLevel_two, #menu_main ul li:hover ul.menu_secondLevel_three {
    display: block;
}
#menu_main .menu_main_sep_right, #menu_main .menu_main_sep_left {
    position: absolute;
    bottom: 0px;
    right: 0px;
    display: block;
    width: 1px;
    height: 69px;
    overflow: hidden;
}
#menu_main .menu_main_sep_left {
    background-position: bottom right;
    left: 0px;
}


/* Sec Menue */
.scnd_menu {
    display: none;
    position: absolute;
    z-index: 999;
    padding-top: 5px;
    padding-bottom: 5px;
    letter-spacing: normal;
    width: auto;
    max-width: 1030px;
    max-height: 365px;
    background-color: #fff;
}

#scnd_menu_wrapper {
    margin: 0;
    width: auto;
}

#scnd_menu_wrapper li {
    diplay: block;
    margin-left: 5px !important;
}
#scnd_menu_wrapper li:last-child {
    float: right;
}
ul.menu_secondLevel {
    display: none;
}

#menu_main ul li ul.menu_secondLevel li {
    float: none;
    width: auto;
    margin-left: 0px;
    margin-right: 0.5em;
    margin-bottom: 5px;
    margin-top: 5px;
}
#menu_main ul li ul.menu_secondLevel li a {
    display: inline;
    width: auto;
    font-size: 0.85em;
    color: #AF0008;
    white-space: nowrap;
}
#menu_main ul li ul.menu_secondLevel li.active,
#menu_main ul li ul.menu_secondLevel li.active a,
#menu_main ul li ul.menu_secondLevel li a:hover {
    background: none;
    color: #2c211a;
}
#menu_main ul li ul.menu_secondLevel li.active a:hover {
    font-style: italic;
}

/* Exeptions */
#menu_main ul li.last {
    position: relative;
}
#menu_main ul li.last .scnd_menu {
    right: -26px;
}
#menu_main ul li:nth-child(3) .scnd_menu {
    margin-left: -155px;
}
#menu_main ul li:nth-child(7) .scnd_menu {
    margin-left: -613px;
}

It works fine, but the problem ist, if I go on the first page of a second level the menu gets destroyed. It only happens there, nowhere else.

I am really tired right now after two days of trying. It seems that somehow some of the

  • elements get ripped out of their original but i don't know why! Maybe somebody sees my failure?!

    Thank You!

  • Ok, I figured it out.

    The problem was in two figures:

    1.) I had two <ul>'s right after each other in

    2 = TMENU
    2 {
    wrap = <div class="scnd_menu"><ul>|</ul></div>
    NO.allWrap = <ul id="scnd_menu_wrapper"><li><ul> </span>
    class="menu_secondLevel"><li>|</li> || ...
    

    Because of the allWrap another <ul> is set.

    So I changed it to wrapItemAndSub instead of allWrap .

    And: 2.) WI was still splitting in NO and NO got copied to ACT and then ACT.allWrap the splitting was overwriten by allwrap ....

    I apologize for that dump mistake!

    The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM