javascript - jQuery 3.2.1 与旧脚本不兼容
问题描述
我有这个旧代码现在不能与新的 jQuery 库一起使用。它适用于 1.7.2,但我现在使用的是 3.2.1。代码中是否有任何更改,以便它可以与新库一起使用?
<div class="last-screem-open" id="last-screem-open" onclick="$('#last-screem-open,#last-screem-text,#last-screem-open-button').animate({left: '-=60'}, 200, 'linear');$('#last-screem-wrapped').delay(300).animate({left: '+=250'}, 200, 'linear');">
<b class="last-screem-open-button" id="last-screem-open-button">▸</b><span id="last-screem-text">TExt</span>
</div>
(function($) {
$('.macro-post-poster img, .post-block-poster img').show().lazyload({
effect: 'fadeIn',
threshold: 200
});
$("img.lazy").lazyload({
container: $("#right")
});
})(jQuery);
解决方案
您可以使用Jquery migrate ,在您的工作jquery 库 (1.7.x)之后添加它,它将突出显示您需要更改的内容以使您的代码在版本 3.x 中工作。
只需检查控制台的输出即可。
推荐阅读
- ibm-watson - 训练 ibm watson 发现
- ios - Apple Watch:这是让 Apple Watch 应用获取新数据的好方法吗?
- javascript - vue-cli v3 与 node.js firebase 函数,firebase 托管(错误:在函数源目录中找不到 npm 包)
- python - 将值附加到python字典中的键
- php - PHP 通过 URL 传递一个单独的表值
- python - “/usr/lib/python3.6/json/init.py”,第 296 行,在加载返回加载(fp.read(),MemoryError
- javascript - javascript 在我输入时不影响 html
- javascript - 使 jquery 选择器动态化
- database - 查找 .accde Access 可执行文件引用的数据库或文件?
- c++ - 在 Visual Studio 2017 中构建程序时出错