MenuItem 不能弹出,并且 clieck 不适用于 asp.net 中的菜单项

MenuItem cannot be popuop and the clieck not work for the menu item in asp.net

提问人:want_to_be_calm 提问时间:9/19/2023 更新时间:9/19/2023 访问量:13

问:

我从 2016 年更新到 2020 年。但是,当我尝试将鼠标悬停在弹出的菜单上时 菜单项。它总是无法提示。

这是代码

$(document).ready(function () {
    $(document).on("mouseenter", ".customMenuItem", function () {
        var menuItem = $(this);
        // Remove rmItem class
        menuItem.removeClass("rmItem");
        openMenu(menuItem);
    });

    $(document).on("mouseleave", ".customMenuItem", function () {
        var menuItem = $(this);
        // Remove rmItem class
        menuItem.removeClass("rmItem");
        closeMenu(menuItem);
    });

    $(window).resize(function () {
        adjustMenuTileContainer();
    });

    adjustMenuTileContainer();        

    $("#wrapperContent").click(function () {
        $(".openc").each(function () {
            $(this).removeClass("openc");
        });
    });

    //$(".menuTile").click(function () {
    //    window.location.href = $(this).attr("navigateurl");
    //});

    $(document).on("click", ".menuTile", function () {
        window.location.href = $(this).attr("navigateurl");
    });       
    
});

对于 openMenu(menuItem),对于 2016 版本,menuItem 将始终为 .但是,在 2020 年,它将成为“li.rmItem.customerMenuItem”,因此 CSS 不起作用。那么我该如何解决这个问题呢?li.customMenuItem

当 menuItem 弹出时,无法单击菜单。似乎asp:panel没有正确呈现。

<telerik:RadMenu ID="mainMenu" runat="server" EnableRoundedCorners="false" RenderMode="lightweight" EnableSelection="false" EnableShadows="true" CssClass="hidden" >
                        <Items>
                            <telerik:RadMenuItem runat="server" AccessKey="A" Text="Administration" ToolTip="Administration" Value="lnkAdministration" NavigateUrl="#" meta:resourcekey="Administration" CssClass="customMenuItem">
                                <ContentTemplate>
                                    <div class="dropdown-menuc">
                                        <div class="menuIdentity" id="mm1"></div>
                                        <div class="col-md-12 menuHeader">
                                            <asp:Label runat="server" meta:resourcekey="Administration"></asp:Label>
                                        </div>
                                        <div class="section col-md-12" runat="server" ID="divUserSession">
                                                <asp:Label runat="server" meta:resourcekey="lblUserRelated"></asp:Label>
                                            <hr /></div>

                                        <div class="section col-md-12" runat="server" ID="divSystemSession">
                                            <asp:Label runat="server" meta:resourcekey="lblSystemRelated"></asp:Label>                                                
                                            <hr /></div>                                                                                        
                                        
                                        <asp:Panel ID="liMenuItemAdmProjCode" runat="server"  CssClass="menuTileContainer col-md-2 col-xs-6 col-sm-4">
                                            <div class="menuTile" NavigateUrl="ProjectCodeMgt.aspx">
                                                <div><img src="images/menuIcon/projectCodeMgt.png" /></div>
                                                <asp:Label runat="server" Text="Project Code Management" meta:resourcekey="ADM_PROJCODE"></asp:Label>
                                            </div>
                                        </asp:Panel>                                  

                                    </div>
                                </ContentTemplate>
                                <Items>                               
                                </Items>                                    
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" AccessKey="H" NavigateUrl="Main.aspx" Text="Home" ToolTip="Home" Value="lnkHome" meta:resourcekey="Home">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" AccessKey="D" Text="Dashboard" ToolTip="Dashboard" Value="lnkDashboard" NavigateUrl="~/dashboard/DB_Home.aspx" meta:resourcekey="ANALYSIS_DASHBOARD">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" AccessKey="M" Text="My AMDP" ToolTip="My AMDP" Value="lnkMyAMDP" NavigateUrl="#" meta:resourcekey="MyAMDP" CssClass="customMenuItem">
                                <ContentTemplate>
                                    <div class="dropdown-menuc">
                                        <div class="menuIdentity" id="mm2"></div>
                                        <div class="col-md-12 menuHeader">
                                            <asp:Label runat="server" meta:resourcekey="MyAMDP"></asp:Label>
                                        </div>                                            

                                        <asp:Panel ID="liMenuItemMyAMDPAdvQTopUp" runat="server" CssClass="menuTileContainer col-md-2 col-xs-6 col-sm-4"  >
                                            <div class="menuTile" NavigateUrl="AdvQTopup.aspx">
                                                <div><img src="images/menuIcon/topup.png" /></div>
                                                <asp:Label runat="server" Text="Top-up" meta:resourcekey="Topup"></asp:Label>
                                            </div>
                                        </asp:Panel>
                       
                                    </div>
                                </ContentTemplate>
                                <Items>
                            
                                </Items>
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" AccessKey="R" Text="Reporting" ToolTip="Reporting" Value="lnkReporting" NavigateUrl="#" meta:resourcekey="Reporting" CssClass="customMenuItem">
                                <ContentTemplate>
                                    <div class="dropdown-menuc">
                                        <div class="menuIdentity" id="mm3"></div>
                                        <div class="col-md-12 menuHeader">
                                            <asp:Label runat="server" meta:resourcekey="Reporting"></asp:Label>
                                        </div>
                                        <asp:Panel ID="liMenuItemRptGen" runat="server"  CssClass="menuTileContainer col-md-2 col-xs-6 col-sm-4">
                                            <div class="menuTile" NavigateUrl="Report_Main.aspx">
                                                <div><img src="images/menuIcon/reportMain.png" /></div>
                                                <asp:Label runat="server" Text="Report Generation" meta:resourcekey="REPORT_GENERATE"></asp:Label>
                                            </div>
                                        </asp:Panel>
                                    </div>
                                </ContentTemplate>
                                <Items>                               
                                </Items>
                            </telerik:RadMenuItem>                                
                        </Items>
                    </telerik:RadMenu>

当我单击菜单项时,它不会进入单击功能。

$(document).on("click", ".menuTile", function () {
        window.location.href = $(this).attr("navigateurl");
    });

似乎菜单项的点击不起作用,可能的原因是什么以及我如何做到 调试并修复它?

JavaScript CSS asp.net Telerik Radmenu

评论

0赞 want_to_be_calm 9/19/2023
需要单击两次 asp 面板才能触发单击操作。

答: 暂无答案