jQuery 3.0 $(window).load(function(){});

所以jQuery 3.0今天发布了,由于某种原因,以下代码不再适用于我的网站:
$(window).load(function() {});

任何人都可以建议我如何解决这个问题或者当/ every /加载时激活的替代方案?

解决方法

breaking-change-load-unload-and-error-removed开始阅读:

Breaking change: .load(),.unload(),and .error() removed

These methods are shortcuts for event operations,but had several API limitations. The event .load() method conflicted with the ajax .load() method. The .error() method Could not be used with window.onerror because of the way the DOM method is defined. If you need to attach events by these names,use the .on() method,e.g. change $(“img”).load(fn) to $(img).on(“load”,fn).

因此,您需要更改:

$(window).load(function() {});

至:

$(window).on("load",function (e) {})

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...