0

我在特殊标签之后(在 div 结束之后)插入子菜单时遇到问题。我想要的是:

<li>
 <div class="toggle">Menu1</div>
 <ul style="display: none;" class="content">
    <li class="first2"><a href="#">menu2</a></li>
   <li class="first2"><a href="#">menu2</a></li>
 </ul>
</li>

但我得到的是:

<li>
 <div class="toggle">Menu1
 <ul style="display: none;" class="content">
    <li class="first2"><a href="#">menu2</a></li>
   <li class="first2"><a href="#">menu2</a></li>
 </ul>
 </div>
</li>

我的代码打字稿是:

 lib.menuVertical= HMENU
 lib.menuVertical.wrap = <ul class="rgaccordmenu"> |</ul>
 lib.menuVertical.entryLevel = 1

 lib.menuVertical{
     1 = TMENU
     1{

        # no state: formatting for normal items
        expAll = 1
    NO{
          wrapItemAndSub = <li><div class="empty">|</div></li>
    }
            # act state: valid from the rootpage to the actual page
    ACT=1
    ACT{
      wrapItemAndSub = <li class="empty">|</li>
    }
            # cur state: valid for the actual page
    CUR=1
    CUR{
      wrapItemAndSub = <li class="empty">|</li>
    }
            # ifsub state: valid for pages that have subpages
    IFSUB=1
    IFSUB{
     wrapItemAndSub = <li><div class="toggle">|</div></li>

    }
    }
  2 = TMENU
   after = </div>
  2.wrap = <ul style="display: none;" class="content">|</ul>
    2{
      NO{

      wrapItemAndSub = <li class="first2">|</li>
    }
    ACT=1
    ACT{
      wrapItemAndSub = <li class="first2">|</li>
    }
    CUR=1
    CUR{
      wrapItemAndSub = <li class="first2">|</li>
    }
    IFSUB=1
    IFSUB{
      wrapItemAndSub = <li class="first2">|</li>
    }
    }

}

您知道如何在 not in ... 之后插入子菜单,谢谢。

4

1 回答 1

2

wrapItemAndSub顾名思义,将包装整个项目,包括子页面。linkWrap是你需要的。

尝试以下操作:

lib.menuVertical= HMENU
lib.menuVertical {
    wrap = <ul class="rgaccordmenu">|</ul>
    entryLevel = 1

    1 = TMENU
    1 {
        expAll = 1

        # no state: formatting for normal items
        NO {
            wrapItemAndSub = <li>|</li>
            linkWrap = <div class="empty">|</div>
        }

        # act state: valid from the rootpage to the actual page
        ACT = 1
        ACT {
            wrapItemAndSub = <li class="empty">|</li>
        }

        # cur state: valid for the actual page
        CUR = 1
        CUR < .ACT

        # ifsub state: valid for pages that have subpages
        IFSUB = 1
        IFSUB {
            wrapItemAndSub = <li>|</li>
            linkWrap = <div class="toggle">|</div>
        }
    }
    2 = TMENU
    2 {
        wrap = <ul style="display: none;" class="content">|</ul>

        NO {
            wrapItemAndSub = <li class="first2">|</li>
        }

        # these are not needed if their content equals
        # ACT = 1
        # ACT < .NO

        # CUR = 1
        # CUR < .NO

        # IFSUB = 1
        # IFSUB < .NO
    }
}
于 2013-03-19T13:40:52.120 回答