Jquery Conflict给出了错误

处理具有各种function的项目,例如:

  • 谷歌翻译器
  • 图像滑块[使用galleriffic]
  • 弹出窗口[使用阴影框]
  • JavaScript水平菜单栏*

现在我们得到jquery冲突和错误信息,如 错误信息

我知道当代码找不到jquery文件但文件存在时会发生这样的消息。

以下是项目中使用的文件列表这是谷歌翻译所需要的

1. 2.  3.  4.  5.  6.  7.  

这个是滑块

  1.  2.  3.  

这是针对弹出窗口的

  1.  2.  3.  4.  

水平菜单需要这样做

  1.  2.  3.  

我已经优化了所有这些并且只包含了一个jquery-1.9.1.min.js的jquery文件,但仍然无法清除冲突这是我使用的序列

  1.  2. 3.  4.  5.  6.  7.  8.  9.  10.  11. 12.  13.  14.  15. 16.  

我尝试了所有这些

http://api.jquery.com/jQuery.noConflict/

http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/?rdfrom=http%3A%2F%2Fdocs.jquery.com%2Fmw%2Findex.php%3Ftitle%3DUsing_jQuery_with_Other_Libraries%26redirect %3Dno

http://www.w3schools.com/jquery/jquery_noconflict.asp

我尝试了所有这些

     $.noConflict(); // Code that uses other library's $ can follow here.  

要么

     $.noConflict(); jQuery(document).ready(function($) { // Code that uses jQuery's $ can follow here. }); // Code that uses other library's $ can follow here.  

要么

 jQuery.noConflict(); (function($) { $(function() { // more code using $ as alias to jQuery }); })(jQuery); // other code using $ as an alias to the other library 

但仍无法获得解决方案

当我删除这个滑块代码时,每件事都运行正常,没有错误,但滑块不起作用

    jQuery(document).ready(function($) { // We only want these styles applied when javascript is enabled $('div.navigation').css({'width' : '', 'float' : 'right'}); $('div.content').css('display', 'block'); // Initially set opacity on thumbs and add // additional styling for hover effect on thumbs var onMouseOutOpacity = 0.67; $('#thumbs ul.thumbs li').opacityrollover({ mouseOutOpacity: onMouseOutOpacity, mouseOverOpacity: 1.0, fadeSpeed: 'fast', exemptionSelector: '.selected' }); // Initialize Advanced Galleriffic Gallery var gallery = $('#thumbs').galleriffic({ delay: 2500, numThumbs: 15, preloadAhead: 10, enableTopPager: true, enableBottomPager: true, maxPagesToShow: 7, imageContainerSel: '#slideshow', controlsContainerSel: '#controls', captionContainerSel: '#caption', loadingContainerSel: '#loading', renderSSControls: true, renderNavControls: true, random: true, prevLinkText: '', nextLinkText: '', nextPageLinkText: '', playLinkText: '', pauseLinkText: '', prevPageLinkText: '', enableHistory: false, autoStart: false, syncTransitions: true, defaultTransitionDuration: 900, onSlideChange: function(prevIndex, nextIndex) { // 'this' refers to the gallery, which is an extension of $('#thumbs') this.find('ul.thumbs').children() .eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end() .eq(nextIndex).fadeTo('fast', 1.0); }, onPageTransitionOut: function(callback) { this.fadeTo('fast', 0.0, callback); }, onPageTransitionIn: function() { this.fadeTo('fast', 1.0); } }); });   

有人可以帮忙吗?

尝试在jQuery中使用.noConflict()

     

我阅读了您的问题并在网站上搜索您使用的每个插件。

  • 任何List Scroller
  • Shadowbox.js
  • 原型
  • Galleriffic

如果缺少插件,请发布它。

我有类似的问题,我没有使用$.noConflict(true);

如果你的项目是服务器,当它打开时采取文件html。

我建议你在一个文件html中插入外部div的调用。

在每个文件html中你都可以编写脚本

  $(document).ready(function () { ............. }); 

您无法在每个文件html中调用外部文件,因为这会产生正常冲突。

和..

我建议这个网站查看最后的库… Google-libraries-last

和..

 I have optimized all these and have included only one jquery file of jquery-1.9.1.min.js but still not able to clear the conflict Here is the sequence used by me 

这个更好。

和:::

对于错误TypeError: $ is not a function取决于如何实现或写入此函数。 可能的错误是;{}()这是因为已经加载了另一个javascript库并覆盖了jQuery的对象$()快捷方式。 因此,当我们在jquery之外包含其他javascript库时,我们将jquery库暴露给冲突。 许多JavaScript库使用$作为函数或变量名,就像jQuery一样。 在jQuery的情况下,$只是jQuery的别名,因此所有function都可以在不使用$情况下使用。 一个解决方案,如果我们需要使用另一个JavaScript库和jQuery,我们可以通过调用$.noConflict()$.noConflict()控制权返回给另一个库,如:

    

另一个解决方案是将jquery对象$()重新分配给jquery库,在一个重新分配$()对象的函数中包含我们的调用。 因此,我们确保我们的代码不会与Prototype,Scriptaculous等混淆。

 ( function($) { // Your jquery code } ) ( jQuery ); 

假设:

     

这种方法是一种自调用匿名函数样式,以避免与jQuery冲突。 如果你不使用它,那么你必须输入jQuery()而不是它的对象$() 。 例:

 $(document) //won't work jquery(document) //will work 

JSFIDDLE.NET上的示例

最后

 Typeerror for null 

查看jquery-documentready-controlid-is-null

我顺其自然,错误得到了解决。 不需要任何.noConflict()和!!!

 1) 2) 3) 4) 5) 6) 7) 8) 9) 10) 11) 12) 

与prototype.js冲突的缩小版本javascript。 我刚刚删除了prototype.js文件并按顺序排列了所有参考文件[ Sequence很重要 ]

现在错误被删除我仍然想知道prototype.js的实际问题是什么?