【问题标题】:What is the total menu levels in the mmenu? I need 5 levels菜单中的总菜单级别是多少?我需要5个级别
【发布时间】:2015-02-27 15:05:54
【问题描述】:

我正在使用 mmenu (http://mmenu.frebsite.nl/)。我需要向下钻取至少 4 个级别,可能是 5 个。菜单将向下钻取的级别是否有限制?如果是这样,我怎样才能达到至少四个级别的向下钻取? 提前感谢您的帮助!

     Private Sub RenderMSRows()

            Dim ReportName As String
            Dim ReportNamesub As String
            Dim ReportCategory As String
            Dim ReportCategorySub As String
            Dim ReportCategoryYear As String
            Dim ReportNameYear As String

            Dim HTMLString As String = ""
            Dim ulString As String = "<ul data-role=" & Chr(34) & "listview" & Chr(34) & ">" & vbCrLf



            'Get the Main Category

            HTMLString = HTMLString & ulString
            For Each mc In _ReportMasters
                ReportName = mc.Report_Name

                HTMLString = HTMLString & "<li>" & vbCrLf
                HTMLString = HTMLString & "<span title='" & ReportName & "'>" & ReportName & "</span>" & vbCrLf


                'Get the Sub Category List

                HTMLString = HTMLString & "<ul>" & vbCrLf
                HTMLString = HTMLString & "<li>" & vbCrLf

                For Each sc In _ReportDetails
                    ReportNamesub = sc.Report_Name
                    ReportCategory = sc.Report_Category

                    If ReportNamesub = ReportName  Then
                        HTMLString = HTMLString & "<a href='' title='" & ReportName & "'>" & ReportCategory & "</a>" & vbCrLf
                    End If
***from here is where it will lock up if I don't quote it out***
                    'Get the Year List

                    HTMLString = HTMLString & "<ul>" & vbCrLf
                    HTMLString = HTMLString & "<li>" & vbCrLf

                    For Each y In _ReportCategoryandYears
                        ReportNameYear = y.Report_Name
                        ReportCategoryYear = y.Report_Year
                        ReportCategorySub = y.Report_Category
                        If ReportCategorySub = ReportCategory And ReportNameYear = ReportName Then
                            HTMLString = HTMLString & "<a href='' title='" & ReportCategoryYear & "'>" & ReportCategoryYear & "</a>" & vbCrLf
                        End If
                    Next
                    HTMLString = HTMLString & "</li>" & vbCrLf
                    HTMLString = HTMLString & "</ul>" & vbCrLf
 ***to here***   
                Next
                HTMLString = HTMLString & "</li>" & vbCrLf
                HTMLString = HTMLString & "</ul>" & vbCrLf
                HTMLString = HTMLString & "</li>" & vbCrLf

            Next

            HTMLString = HTMLString & "</ul>"
            Me.MenuBar.Text = HTMLString

        End Sub

【问题讨论】:

  • 你试过使用菜单,看看它支持多少级别?
  • 子菜单的级别没有限制,但超过 3 个确实需要考虑替代结构。超过 3 个对用户交互的影响非常,而且 IMO 提供了糟糕的用户体验。您可以尝试在ux.stackexchange.com 上寻找提示
  • @Richard Everett - 我试图“查看”多少级别,但我真的不知道编码的哪一部分“允许”这么多级别。我是 jquery 的新手,这是一个我非常喜欢的菜单,我尝试处理第三个子级别,它被锁定了......这个脚本很忙等等。当我引用第三个子菜单(ul/li)时,它会锁定。我的菜单是用数据库构建的。我的另一篇文章与此有关。所以...据我所知,它允许 2 个级别。
  • @Paulie_D - 我会检查你的链接。感谢您的建议。
  • @TanyaHammil - 如果您可以编辑您的问题以向我们展示您的尝试,那么我们应该能够提供帮助。

标签: html css asp.net mmenu


【解决方案1】:

以下是向下钻取 5 个级别的工作代码。我发现 UL 和 LI 元素需要按正确的顺序放置。

将 ReportNameSub 调暗为字符串 将 ReportCategorySub 调暗为字符串 将 ReportOrderSub 调暗为字符串

        Dim ReportNameYear As String
        Dim ReportCategoryYear As String
        Dim ReportOrderYear As String
        Dim ReportYear As String

        Dim ReportNameMonth As String
        Dim ReportCategoryMonth As String
        Dim ReportOrderMonth As String
        Dim ReportYearMonth As String
        Dim ReportMonth As String

        Dim ReportNameLocation As String
        Dim ReportCategoryLocation As String
        Dim ReportOrderLocation As String
        Dim ReportYearLocation As String
        Dim ReportMonthLocation As String
        Dim ReportSubNameLocation As String
        Dim ReportLocation As String

        Dim HTMLString As String = ""
        Dim ulString As String = "<ul data-role=" & Chr(34) & "listview" & Chr(34) & ">" & vbCrLf

        'Get the Main Category

        HTMLString = HTMLString & ulString

        For Each mc In _ReportMasterSorteds
            ReportName = mc.report_name
            ReportOrder = mc.Report_Order

            If ReportName <> "" Then
                HTMLString = HTMLString & "<li>" & vbCrLf
                HTMLString = HTMLString & "<span title='" & ReportName & "'>" & ReportName & "</span>" & vbCrLf

                'Get the Sub Category List
                HTMLString = HTMLString & "<ul>" & vbCrLf

                For Each sc In _ReportDetails
                    ReportNameSub = sc.Report_Name
                    ReportCategorySub = sc.Report_Category
                    ReportOrderSub = sc.Report_Order

                    If ReportOrderSub = ReportOrder And ReportNameSub = ReportName Then
                        HTMLString = HTMLString & "<li>" & vbCrLf
                        HTMLString = HTMLString & "<span title='" & ReportName & "'>" & ReportCategorySub & "</span>" & vbCrLf

                        ' Get the Year List
                        HTMLString = HTMLString & "<ul>" & vbCrLf

                        For Each y In _ReportCategoryandYears
                            ReportNameYear = y.Report_Name
                            ReportCategoryYear = y.Report_Category
                            ReportOrderYear = y.Report_Order
                            ReportYear = y.Report_Year

                            If ReportOrderYear = ReportOrderSub And ReportNameYear = ReportNameSub And ReportCategoryYear = ReportCategorySub Then
                                HTMLString = HTMLString & "<li>" & vbCrLf
                                HTMLString = HTMLString & "<span title='" & ReportCategoryYear & "'>" & ReportYear & "</span>" & vbCrLf

                                ' Get the Month List
                                HTMLString = HTMLString & "<ul>" & vbCrLf

                                For Each m In _ReportDetailMonths
                                    ReportNameMonth = m.Report_Name
                                    ReportCategoryMonth = m.Report_Category
                                    ReportOrderMonth = m.Report_Order
                                    ReportYearMonth = m.Report_Year
                                    ReportMonth = m.Report_Frequency

                                    If ReportOrderMonth = ReportOrderYear And ReportNameMonth = ReportNameYear And ReportCategoryMonth = ReportCategoryYear And ReportYearMonth = ReportYear Then
                                        HTMLString = HTMLString & "<li>" & vbCrLf
                                        HTMLString = HTMLString & "<span title='" & ReportYear & "'>" & ReportMonth & "</span>" & vbCrLf


                                        ' Get the Name and Location List
                                        HTMLString = HTMLString & "<ul>" & vbCrLf

                                        For Each l In _ReportDetailReportandLocations
                                            ReportNameLocation = l.Report_Name
                                            ReportCategoryLocation = l.Report_Category
                                            ReportOrderLocation = l.Report_Order
                                            ReportYearLocation = l.Report_Year
                                            ReportMonthLocation = l.Report_Frequency
                                            ReportSubNameLocation = l.Sub_Report_Name
                                            ReportLocation = l.Report_Location

                                            If ReportOrderLocation = ReportOrderMonth And ReportNameLocation = ReportNameMonth And ReportCategoryLocation = ReportCategoryMonth And ReportYearLocation = ReportYearMonth And ReportMonthLocation = ReportMonth Then
                                                HTMLString = HTMLString & "<li>" & vbCrLf
                                                HTMLString = HTMLString & "<a href=''  title='" & ReportMonth & "'>" & ReportSubNameLocation & "</a>" & vbCrLf
                                                HTMLString = HTMLString & "</li>" & vbCrLf
                                            End If

                                        Next
                                        'end of Name and Location list
                                        HTMLString = HTMLString & "</ul>" & vbCrLf
                                        HTMLString = HTMLString & "</li>" & vbCrLf
                                    End If

                                Next
                                'end of Month list
                                HTMLString = HTMLString & "</ul>" & vbCrLf
                                HTMLString = HTMLString & "</li>" & vbCrLf
                            End If

                        Next
                        end of year list

                        HTMLString = HTMLString & "</ul>" & vbCrLf
                        HTMLString = HTMLString & "</li>" & vbCrLf
                    End If

                Next
                'End of subcat list

                HTMLString = HTMLString & "</ul>" & vbCrLf
                HTMLString = HTMLString & "</li>" & vbCrLf
            End If
        Next
        'end of cat list

        HTMLString = HTMLString & "</ul>"

        Me.menubar.Text = HTMLString

【讨论】:

    猜你喜欢
    • 2017-03-12
    • 2015-04-05
    • 1970-01-01
    • 2013-01-19
    • 2017-07-04
    • 2012-07-19
    相关资源
    最近更新 更多