jQuery SuperFish 错误:jQuery(“ul.sf-menu”).superfish 不是函数

发布于 2024-12-21 16:43:39 字数 1916 浏览 0 评论 0原文

我的 superfish 下拉菜单有问题 - 在我将 jQuery.Columnizer 添加到我的项目之前它工作正常。取出列生成器 jQuery 修复了 superfish.js 的问题 - 然而,当两者都启用并运行时,当您将鼠标悬停在菜单上时,会显示下拉菜单,但当您尝试单击下拉列表中的菜单链接时,下拉菜单会消失。我似乎无法解决这个问题 - 我已经用谷歌搜索并遵循了各种建议和示例,但无济于事。

我正在使用分栏器将内容分成 3 列。问题是因为我引用了 2 个 jquery 库吗?

Superfish.js

<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css' />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<link href="/assets/css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/assets/css/superfish.css" media="screen" />
<script type="text/javascript" src="/assets/js/hoverIntent.js"></script>
<script type="text/javascript" src="/assets/js/superfish.js"></script>
<script type="text/javascript" src="/assets/js/jquery-1.2.6.min.js"></script>

  <script type="text/javascript">
      // initialise plugins
      $(document).ready(function () {
          jQuery('ul.sf-menu').superfish();
          //alert("hello i am working... maybe or maybe not!");
      });
</script>

Columnizer.js

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="/assets/js/jquery.columnizer.min.js" type="text/javascript"></script>

<script type="text/javascript">
$('#wrapper').columnize();
$('.wide').columnize({ width: 200 });
</script>

更新: 这是问题的解决方案;

<add key="**********.*********.***.JQuery.Path" value="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"/>

取出以前的引用并使用最新的 CDN 更新它,确保它完美工作 - 我在我的 webconfig 中引用了 .JS,然后在页面后面引用了代码。唷..现在正在工作 - 感谢您所有的帮助。

I am having problems with my superfish drop down menu - it was working fine before i added the jQuery.Columnizer to my project. Taken out the columnizer jQuery fixes the problem for the superfish.js - however when both are enabled and running the drop down menu is displayed when you hover over the menu but when you try clicking on the menu link in the dropdown the dropdown disappears. I cant seem to fix this problem - i've googled around and followed various advice and examples but to no avail.

I am using the columnizer to split up my content in to like 3 columns. Is the problem because i am referencing 2 jquery libraries?

Superfish.js

<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css' />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<link href="/assets/css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/assets/css/superfish.css" media="screen" />
<script type="text/javascript" src="/assets/js/hoverIntent.js"></script>
<script type="text/javascript" src="/assets/js/superfish.js"></script>
<script type="text/javascript" src="/assets/js/jquery-1.2.6.min.js"></script>

  <script type="text/javascript">
      // initialise plugins
      $(document).ready(function () {
          jQuery('ul.sf-menu').superfish();
          //alert("hello i am working... maybe or maybe not!");
      });
</script>

Columnizer.js

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="/assets/js/jquery.columnizer.min.js" type="text/javascript"></script>

<script type="text/javascript">
$('#wrapper').columnize();
$('.wide').columnize({ width: 200 });
</script>

UPDATE: Here is the solution to the problem;

<add key="**********.*********.***.JQuery.Path" value="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"/>

taking out both the previous references and updating it with the latest CDN ensured it was working perfectly - i referenced the .JS in my webconfig and then code behind page. Phew.. working now - thanks for all your help people.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戏舞 2024-12-28 16:43:39

您要添加 jquery 两次,请删除此行

<script type="text/javascript" src="/assets/js/jquery-1.2.6.min.js"></script>

,或者如果由于插件支持而需要在同一页面上包含两个版本的 jquery,请参阅此答案

https://stackoverflow.com/a/528251/413670

编辑

如果你的插件支持 jquery 版本试试这个

<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css' />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<link href="/assets/css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/assets/css/superfish.css" media="screen" />
<script type="text/javascript" src="/assets/js/hoverIntent.js"></script>
<script type="text/javascript" src="/assets/js/superfish.js"></script>
<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css' />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<link href="/assets/css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/assets/css/superfish.css" media="screen" />
<script type="text/javascript" src="/assets/js/hoverIntent.js"></script>
<script type="text/javascript" src="/assets/js/superfish.js"></script>
<script src="/assets/js/jquery.columnizer.min.js" type="text/javascript"></script>

<script type="text/javascript">
      // initialise plugins
      $(document).ready(function () {
          jQuery('ul.sf-menu').superfish();          
          $('#wrapper').columnize();
         $('.wide').columnize({ width: 200 });

      });
</script>

you are adding jquery twice remove this line

<script type="text/javascript" src="/assets/js/jquery-1.2.6.min.js"></script>

or if you need to include two versions of jquery on the same page because of plugin support refer to this answer

https://stackoverflow.com/a/528251/413670

EDIT

if your plugins support the jquery version try this

<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css' />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<link href="/assets/css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/assets/css/superfish.css" media="screen" />
<script type="text/javascript" src="/assets/js/hoverIntent.js"></script>
<script type="text/javascript" src="/assets/js/superfish.js"></script>
<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css' />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<link href="/assets/css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/assets/css/superfish.css" media="screen" />
<script type="text/javascript" src="/assets/js/hoverIntent.js"></script>
<script type="text/javascript" src="/assets/js/superfish.js"></script>
<script src="/assets/js/jquery.columnizer.min.js" type="text/javascript"></script>

<script type="text/javascript">
      // initialise plugins
      $(document).ready(function () {
          jQuery('ul.sf-menu').superfish();          
          $('#wrapper').columnize();
         $('.wide').columnize({ width: 200 });

      });
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文