JQuery 选项卡和面板在 DNN 版本 08.00.03 中不起作用。它仅在用户登录时有效。一旦用户注销,所有面板和选项卡都将停止工作。
我在 HTML 模块中有以下代码:
<div class="dnnForm" id="panels-demo">
<div class="dnnFormExpandContent"><a href="">Expand All</a></div>
<h2 id="ChristopherColumbus" class="dnnFormSectionHead"><a href="#">Christopher Columbus</a></h2>
<fieldset class="dnnClear">
<img src="<%=ResolveUrl("Images/498px-Christopher_Columbus.PNG") %>" alt="Christopher Columbus" width="32%" class="dnnLeft" />
<div class="dnnRight" style="width:62%;margin-left:2%">
<h1>Christopher Columbus</h1>
<p>Italian navigator, colonizer and explorer whose voyages led to general European awareness of the American continents.</p>
</div>
</fieldset>
<h2 id="IsaacNewton" class="dnnFormSectionHead"><a href="#">Isaac Newton</a></h2>
<fieldset class="dnnClear">
<img src="<%=ResolveUrl("Images/GodfreyKneller-IsaacNewton-1689.jpg") %>" alt="Isaac Newton" width="32%" class="dnnLeft" />
<div class="dnnRight" style="width:62%;margin-left:2%">
<h1>Isaac Newton</h1>
<p>English physicist, mathematician, astronomer, natural philosopher, alchemist, and theologian. His law of universal gravitation and three laws of motion laid the groundwork for classical mechanics.</p>
</div>
</fieldset>
<h2 id="JohannesGutenberg" class="dnnFormSectionHead"><a href="#">Johannes Gutenberg</a></h2>
<fieldset class="dnnClear">
<img src="<%=ResolveUrl("Images/Gutenberg.jpg") %>" alt="Johannes Gutenberg" width="32%" class="dnnLeft" />
<div class="dnnRight" style="width:62%;margin-left:2%">
<h1>Johannes Gutenberg</h1>
<p>German printer who invented the mechanical printing press.</p>
</div>
</fieldset>
</div>
以下代码放置在模块头中:
<script type="text/javascript">
jQuery(function ($) {
var setupModule = function () {
$('#panels-demo').dnnPanels();
$('#panels-demo .dnnFormExpandContent a').dnnExpandAll({
targetArea: '#panels-demo'
});
};
setupModule();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () {
// note that this will fire when _any_ UpdatePanel is triggered,
// which may or may not cause an issue
setupModule();
});
});
</script>
一些 Stackoverflow 问题和其他形式提到添加这行代码:
jQuery.RequestDnnPluginsRegistration();
不确定如何以及在何处添加它,以及它是否会解决问题。上面的代码取自这个网站: http ://uxguide.dotnetnuke.com/UIPatterns/Panels.html