jQuery:替换已弃用的".load()"吗? [英] jQuery : replacement for deprecated ".load()"?
问题描述
jQuery v3.0弃用了绑定到我的.load()
函数,因为我的jQuery脚本要求在运行图像之前先加载它们.有谁知道一种应用先前编码为
jQuery v3.0 deprecates the .load()
function which has me in a bind because my jQuery scripts require that images be loaded before they run. Does anyone know a way to apply what was previously coded as
$(window).ready(function() {
但不使用.load()
导入?
$(window).ready(function()
绝对不起作用,因为它会在加载图像之前触发.
$(window).ready(function()
definitely does NOT work, as it triggers before the images are loaded.
我正在尝试找到一种与jQuery函数配合使用的解决方案.我知道Javascript .onload
,但不确定如何将其网格化作为jQuery例程的线索.
I am trying to find a solution which works well with a jQuery function. I am aware of Javascript .onload
but am not sure how to mesh that as a lead in for jQuery routines.
谢谢!
推荐答案
根据
https://github.com/jquery/jquery/issues/2286 这篇关于jQuery:替换已弃用的".load()"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!已删除不赞成使用的事件别名
从jQuery 1.8开始不推荐使用.load
,.unload
和.error
更多的.使用.on()
注册侦听器.
Removed deprecated event aliases
.load
, .unload
, and .error
, deprecated since jQuery 1.8, are no
more. Use .on()
to register listeners.