Sharepoint2010 - QuickLaunchMenu 手风琴风格
我尝试将 Sharepoint2010 网站的 QuickLaunchMenu 更改为使用手风琴样式。
如何获取当前选中的项目?是否可以将 css 类添加到当前(活动)导航项? 如何添加第三个层级?
这是我的 jQuery 代码:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#s4-leftpanel-content li.static>ul.static").each(function(){
$(this).hide();
});
$("#s4-leftpanel-content ul.root>li.static>a").click(function(ev){
//ev.preventDefault();
var child = $(this).parent().children('ul');
$("#s4-leftpanel-content li.static>ul.static").each(function(){
$(this).hide();
});
child.toggle();
});
//disable heading click
$("#s4-leftpanel-content ul.root>li.static>a").toggle(
function () {},
function () {}
);
});
</script>
这是我的快速启动控件:
<SharePoint:UIVersionedContent UIVersion="4" runat="server">
<ContentTemplate>
<SharePoint:AspMenu id="V4QuickLaunchMenu" runat="server" EnableViewState="false"
DataSourceId="QuickLaunchSiteMap"
UseSimpleRendering="true"
UseSeparateCss="false"
SelectStaticItemsOnly="true"
CustomSelectionEnabled="true"
Orientation="Vertical"
StaticDisplayLevels="3"
MaximumDynamicDisplayLevels="2"
SkipLinkText=""
CssClass="s4-ql">
</SharePoint:AspMenu>
</ContentTemplate>
</SharePoint:UIVersionedContent>
任何帮助将不胜感激。
谢谢!
I try to change QuickLaunchMenu of my Sharepoint2010 site to use accordion style.
How can I get the current selected item? Is there a possibility to add a css class to the current (active) nav-item?
How can I add a third hierarchy level?
This is my jQuery code:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#s4-leftpanel-content li.static>ul.static").each(function(){
$(this).hide();
});
$("#s4-leftpanel-content ul.root>li.static>a").click(function(ev){
//ev.preventDefault();
var child = $(this).parent().children('ul');
$("#s4-leftpanel-content li.static>ul.static").each(function(){
$(this).hide();
});
child.toggle();
});
//disable heading click
$("#s4-leftpanel-content ul.root>li.static>a").toggle(
function () {},
function () {}
);
});
</script>
and this is my quick launch control:
<SharePoint:UIVersionedContent UIVersion="4" runat="server">
<ContentTemplate>
<SharePoint:AspMenu id="V4QuickLaunchMenu" runat="server" EnableViewState="false"
DataSourceId="QuickLaunchSiteMap"
UseSimpleRendering="true"
UseSeparateCss="false"
SelectStaticItemsOnly="true"
CustomSelectionEnabled="true"
Orientation="Vertical"
StaticDisplayLevels="3"
MaximumDynamicDisplayLevels="2"
SkipLinkText=""
CssClass="s4-ql">
</SharePoint:AspMenu>
</ContentTemplate>
</SharePoint:UIVersionedContent>
Any help would be appreciated.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于 AspMenu 继承自 Menu 类(WebControls 命名空间的一部分),
对于主动选择,请参阅 SelectedItem 属性
msdn.microsoft.com/EN-US/library/0f4wwt2y
对于 CSS,有 StaticSelectedStyle、DynamicSelectedSytle 和 LevelSelectedSytles
在您的例子中,您创建了 3 级静态菜单和 2 级动态菜单。查看 CSS 样式的 StaticSelectedStyle 和 DynamicSelectedSytle。
顺便说一句,当您限制自己创建最多 2 级动态菜单时,我相信这就是您无法创建 3 级的原因。
看看这个。
http://msdn.microsoft.com/en-us /library/microsoft.sharepoint.webcontrols.aspmenu_members.aspx
http://msdn.microsoft.com/en-us/library/ms476607.aspx" rel="nofollow">http:/ /msdn.microsoft.com/en-us/library/ms476607.aspx
As the AspMenu is inherited from the Menu class (part of WebControls Namespace) and
For active selected, see SelectedItem property
msdn.microsoft.com/EN-US/library/0f4wwt2y
For CSS, there are StaticSelectedStyle, DynamicSelectedSytle and LevelSelectedSytles
In your case, you created 3 levels of static menu and 2 levels of dynamic menu. take a look on StaticSelectedStyle and DynamicSelectedSytle for CSS style.
BTW, as you limit yourself on creating Maximum 2 levels of dynamic menu, I believe that's why you can't create the 3 levels.
Take a look on this.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.aspmenu_members.aspx
http://msdn.microsoft.com/en-us/library/ms476607.aspx
您好,我找到了一种为共享点快速启动制作手风琴的方法,而无需更改 asp 控件属性。
这就是我的工作方式。
下面的代码添加在“navaccord.js”文件中
希望这对每个人都有帮助,唯一的问题是在选定页面加载后手风琴折叠。
Hi i have found one way to make accordion for the sharepoint Quicklaunch with out changing asp control attributes.
here is the way i have worked.
below code added in "navaccord.js" file
Hope this helps to every one, Only issue will be accordion collapse after selected page loads.