如何使用多个jquery版本,以便ResponsiveSlides.js工作?

时间:2022-03-01 16:33:25

My website uses jquery version 1.11.o and I would like to use ResponsiveSlides.js from GitHub to show a slideshow on my home page but ResponsiveSlides.js uses jquery version 1.8.3 and it conflicts with v1.11.0 so my site breaks.

我的网站使用jquery版本1.11.o并且我想使用来自GitHub的ResponsiveSlides.js在我的主页上显示幻灯片,但是ResponsiveSlides.js使用jquery版本1.8.3并且它与v1.11.0冲突,因此我的网站中断了。

I have tried the solution below that I found in another question so that I can use both jquery version but it didn't work. How can I accomplish this and use both jquery versions without conflict?

我已经尝试了下面的解决方案,我在另一个问题中找到,以便我可以使用两个jquery版本,但它不起作用。如何实现这一点并使用两个jquery版本而不会发生冲突?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script>var $j = jQuery.noConflict(true);</script>
<script>
  $(document).ready(function(){
   console.log($().jquery); // This prints v1.11.0
   console.log($j().jquery); // This prints v1.8.3
  });

1 个解决方案

#1


0  

Using 2 versions of jQuery is not recommended and will cause a load of problems. You should use the jQuery migrate plugin. The plugin restores deprecated features and behaviors so that older code will still run properly on jQuery 1.9 and later. The latest versions would be used like this:

建议不要使用2个版本的jQuery,这会导致大量问题。您应该使用jQuery migrate插件。该插件恢复不推荐使用的功能和行为,以便旧代码仍然可以在jQuery 1.9及更高版本上正常运行。最新版本将使用如下:

<script src="jquery-1.12.3.min.js" type="text/javascript"></script>
<script src="jquery-migrate-1.3.0.min.js" type="text/javascript"></script>

#1


0  

Using 2 versions of jQuery is not recommended and will cause a load of problems. You should use the jQuery migrate plugin. The plugin restores deprecated features and behaviors so that older code will still run properly on jQuery 1.9 and later. The latest versions would be used like this:

建议不要使用2个版本的jQuery,这会导致大量问题。您应该使用jQuery migrate插件。该插件恢复不推荐使用的功能和行为,以便旧代码仍然可以在jQuery 1.9及更高版本上正常运行。最新版本将使用如下:

<script src="jquery-1.12.3.min.js" type="text/javascript"></script>
<script src="jquery-migrate-1.3.0.min.js" type="text/javascript"></script>