更新 jQuery 版本

发布于 2025-01-02 06:50:46 字数 162 浏览 1 评论 0原文

只是想知道是否有任何教程或方法来更新 jQuery 脚本和函数。

我正在运行版本 1.4 和版本 1.6.2,我想将它们都更新为 1.7.1,但我需要修改我的脚本。我不知道从哪里开始以及要改变什么。我可以从哪里开始?

Just wondering if there's any tutorials or ways to update jQuery scripts and functions.

I have version 1.4 and version 1.6.2 running, and I want to update both of them to 1.7.1 but I need to modify my script. I have no clue where to begin and what to change. Where can I start?

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

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

发布评论

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

评论(2

听风吹 2025-01-09 06:50:46

首先阅读每个 jQuery 更新的发行说明。

这是 1.7 API 更改的链接。该页面还包含更改日志的链接

从最早的版本开始,对您需要的每个版本执行此操作。这不仅可以让您了解潜在的重大更改,还可以了解您可以使用的新功能。

对于不同的版本,请参阅我提供的第一个链接左侧的菜单...

在此处输入图像描述


编辑:

由于从评论中提供的链接来看,插件似乎存在问题,您需要检查所有插件的站点以确保您正在使用最新版本。


问题的直接原因

看来您遇到的直接问题是您多次加载 jQuery,并拆除了 basic-jquery- slider.js 插件与第二次加载。

<!--loading jQuery-->
<script src="../js/jquery-1.6.2.min.js"></script>

<!--loading the slider plugin-->
<script src="../js/basic-jquery-slider.js"></script>

<!--loading jQuery again, which is overwriting 
                      the original jQuery and its plugin-->
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.ba-hashchange.min.js'></script>
<script type='text/javascript' src='../js/dynamicpage.js'></script>

您应该只加载一个版本,并在加载任何插件之前加载它。

The place to begin would be to read the release notes of each jQuery update.

Here's the link for 1.7 API changes. That page also includes a link to the change log.

Do this for each version you need, starting with the earliest. This will let you know not only of potential breaking changes, but also of new features that are available to you.

For the different versions, see the menu on the left from the first link I provided...

enter image description here


EDIT:

Since from the link provided in a comment, there seems to be an issue with a plugin, you'll want to check the sites of all your plugins to make sure that you're using the latest version.


Direct cause of the issue

It seems that the direct issue you're having is that you're loading jQuery more than once, and demolishing the basic-jquery-slider.js plugin with the second load.

<!--loading jQuery-->
<script src="../js/jquery-1.6.2.min.js"></script>

<!--loading the slider plugin-->
<script src="../js/basic-jquery-slider.js"></script>

<!--loading jQuery again, which is overwriting 
                      the original jQuery and its plugin-->
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.ba-hashchange.min.js'></script>
<script type='text/javascript' src='../js/dynamicpage.js'></script>

You should load only one version, and load it before any plugins are loaded.

懵少女 2025-01-09 06:50:46

只需更新库并在所有浏览器中测试您的网站即可。除了测试跨浏览器功能之外没有其他方法。

之后,您可以考虑使用 jQuery 发布的最新更改来修复错误或提高性能。这取决于您是否根据您拥有的应用程序类型进行选择。

Just update the library and test your site in all the browsers. There is no other way than testing cross browser functionalities.

After that you can think of using the latest changes jQuery has reelased may be for bug fixing or performance improvement. It depends on you whether to go for it or not based on the kind of application you have.

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