1

我试图让锚标记的数据内容部分中的任何内容显示为弹出菜单。我之前测试它时让它工作,但现在我无法显示数据,我唯一做的就是将更多项目添加到作为模型出现的列表中。任何人都知道为什么我的弹出窗口不起作用?

@helper CreateSubMenu(MenuItem[] menuItems)
{
foreach (var Item in menuItems)
{

    <li><a href="#" id="@Item.HtmlId" rel="popover" data-content="@Item.Description">@Item.Name</a>
        @if (Item.MenuItems.Any())
        {
            @WrapWithUl(Item.MenuItems)
        }
    </li>
}
}
@helper WrapWithUl(MenuItem[] menuItems)
{ <ul>
  @CreateSubMenu(menuItems)
</ul> }


<div class="pull-left demo-dd demo-container span3">

<strong>
    <ul id="drilldown-3">
        @CreateSubMenu(Model.MenuItems)
    </ul>
</strong>
</div>

    <script type="text/javascript">
        $(document).ready(function($){

            $('#drilldown-3').dcDrilldown({
                speed           : 'fast',
                saveState       : false,
                showCount       : false,
                linkType        : 'breadcrumb'
            });
        });

    </script>

这是我在 _layout.cshtml 文件中的导入

    <head>
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/css/bootstrap/bootstrap.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/css/site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/css/base-admin.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/css/base-admin-responsive.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/css/fontAwesome/font-awesome.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/css/dcdrilldown.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/css/skins/demo.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/DataTables-1.9.4/media/css/demo_table.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.9.1.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery-migrate-1.1.1.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.cookie.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.dcdrilldown.1.2.js")"></script>
    <script src="@Url.Content("~/Scripts/bootstrap.js")"></script>
    <script src="@Url.Content("~/Scripts/excanvas.min.js")"></script>
    <script src="@Url.Content("~/Scripts/DataTables-1.9.4/media/js/jquery.dataTables.min.js")"></script>
</head>
4

2 回答 2

1

您需要添加容器:body

$('a[rel=popover]').popover([container: 'body'});
于 2013-03-22T17:21:23.483 回答
0

我发现该示例需要在 ASP.NET MVC5 示例中设置触发器选项。它默认为“点击”

$("#myID").popover({ container: 'body', trigger: 'hover' });
于 2014-04-02T20:26:35.390 回答