簡體   English   中英

jQuery 3.2.1 與舊腳本不兼容

[英]jQuery 3.2.1 is not compatible with an old script

我有這個舊代碼,它現在不適用於新的 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 版中工作。

只需檢查控制台的輸出即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM