我正在尝试获取锚标记的数据内容部分中的任何内容以显示为弹出菜单。我在测试它之前就已经开始工作,但是现在我无法显示数据,我唯一能做的就是将更多项添加到作为模型进入的列表中。 任何人都知道为什么我的popover无效?
@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>
答案 0 :(得分:1)
您需要添加容器:body
$('a[rel=popover]').popover([container: 'body'});
答案 1 :(得分:0)
我发现该示例需要ASP.NET MVC5示例中的触发器选项设置。它默认为“点击”
$("#myID").popover({ container: 'body', trigger: 'hover' });