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版本中工作。

只需检查控制台的输出即可。

最新更新