jQuery的菜单和ASP.NET站点地图 [英] jQuery Menu and ASP.NET Sitemap

查看:161
本文介绍了jQuery的菜单和ASP.NET站点地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使用 ASP.NET web.sitemap中有一个jQuery的快鱼菜单?

Is it possible to use an ASP.NET web.sitemap with a jQuery Superfish menu?

如果不是,是否有任何可用的标准基于浏览器插件无关的Web.sitemap文件的工作?

If not, are there any standards based browser agnostic plugins available that work with the web.sitemap file?

推荐答案

我发现这个问题,同时寻找相同的答案......每个人的的这是可能的,但没有一个人给出实际的解决方案!我似乎现在工作,所以想我会后我发现...

I found this question while looking for the same answer... everyone says it's possible but no-one gives the actual solution! I seem to have it working now so thought I'd post my findings...

东西,我需要:

  • Superfish which also includes a version of jQuery

CSS友好控制适配器下载DLL和.browsers文件(成/ bin和/ App_Browsers文件夹分别)

CSS Friendly Control Adaptors download DLL and .browsers file (into /bin and /App_Browsers folders respectively)

ASP.NET网站地图(一.sitemap XML文件和网​​站在web.config中提供的条目)

ASP.NET SiteMap (a .sitemap XML file and siteMap provider entry in web.config)

我的成品 Masterpage.master 具有以下标签:

My finished Masterpage.master has the following head tag:

<head runat="server">
    <script type="text/javascript" src="/script/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="/script/superfish.js"></script>
    <link href="~/css/superfish.css" type="text/css" rel="stylesheet" media="screen" runat="server" />
    <script type="text/javascript">

        $(document).ready(function() {
        $('ul.AspNet-Menu').superfish();
        }); 

</script>
</head>

这基本上是需要jQuery的快鱼菜单,工作的所有东西。里面的页面(如菜单去)看起来像这样(基于这些指令):

<asp:SiteMapDataSource ID="SiteMapDataSource" runat="server"
    ShowStartingNode="false" />
<asp:Menu ID="Menu1" runat="server" 
    DataSourceID="SiteMapDataSource"
    Orientation="Horizontal" CssClass="sf-menu">
</asp:Menu>

根据文档上,这似乎是它应该工作 - 但事实并非如此。其原因是,在的CssClass =SF-MENU菜单时呈现被覆盖和&LT; UL&GT; 标签得到了类=ASPNET菜单。我觉得行 $('ul.A​​spNet菜单')快鱼(); 会有所帮助,但事实并非如此。

Based on the documentation, this seems like it SHOULD work - but it doesn't. The reason is that the CssClass="sf-menu" gets overwritten when the Menu is rendered and the <ul> tag gets a class="AspNet-Menu". I thought the line $('ul.AspNet-Menu').superfish(); would help, but it didn't.

一件事

虽然这是一个黑客(和请有人点我到正确的解决方案),我是能够得到它通过打开 superfish.css 文件和工作的搜索和替换 SF-菜单 ASPNET-菜单 ...瞧!菜单出现。我以为会有一些配置中的 ASP的设置:菜单控制在那里我可以设置&LT; UL&GT; 类但没有通过谷歌找到任何线索。

Although it is a hack (and please someone point me to the correct solution) I was able to get it working by opening the superfish.css file and search and replacing sf-menu with AspNet-Menu... and voila! the menu appeared. I thought there would be some configuration setting in the asp:Menu control where I could set the <ul> class but didn't find any hints via google.

这篇关于jQuery的菜单和ASP.NET站点地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆