jQuery SuperFish错误:jQuery("ul.sf-menu").superfish不是函数 [英] jQuery SuperFish Error: jQuery("ul.sf-menu").superfish is not a function

查看:128
本文介绍了jQuery SuperFish错误:jQuery("ul.sf-menu").superfish不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的superfish下拉菜单中遇到问题-在将jQuery.Columnizer添加到我的项目之前,它运行良好.取出专栏工具jQuery修复了superfish.js的问题-但是,当两者都启用并运行时,当您将鼠标悬停在菜单上时会显示下拉菜单,但是当您尝试单击下拉菜单中的菜单链接时,下拉菜单将消失.我似乎无法解决此问题-我在Google周围搜索并遵循了各种建议和示例,但无济于事.

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.

我正在使用分栏器将我的内容分成3列.是因为我要引用2个jquery库吗?

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"/>

同时删除先前的参考文献并使用最新的CDN进行更新以确保其工作正常-我在我的webconfig中引用了.JS,然后在页面后面进行了编码. Phew ..现在正在工作-感谢您的所有帮助.

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.

推荐答案

您要添加两次jquery删除此行

you are adding jquery twice remove this line

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

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

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

编辑

如果您的插件支持jquery版本,请尝试

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>

这篇关于jQuery SuperFish错误:jQuery("ul.sf-menu").superfish不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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