.load()在ipad上不起作用 [英] .load() does not work on ipad
问题描述
我有简单的脚本来检查图像,但它在我的ipad 5.1上无法正常工作。在图像中我收到jpg的流,因此加载必须在每个帧上工作(如在大型野生动物园中),但在ipad中它只会触发一次。可能有些建议吗?
I have simple script to check image, but it is not working properly on my ipad with ios 5.1. In image i receive stream of jpg's, so load must work on each frame (as in big safari), but in ipad it fires only once. May be some suggestions?
$('#image').load(function(){
console.log(new Date().getTime(););
});
推荐答案
在jQuery官方网站上提到:
It is mentioned on the jQuery official website:
与图像一起使用时加载事件的注意事项
Caveats of the load event when used with images
开发人员尝试的常见挑战解决使用 .load()
的快捷方式是在图像(或
图像集合)完全加载时执行一个函数。有几个已知的警告,其中
应该注意这一点。这些是:
A common challenge developers attempt to solve using the .load()
shortcut is to execute a function when an image (or collection of
images) have completely loaded. There are several known caveats with
this that should be noted. These are:
- 它不能一致地工作也不能可靠地跨浏览器
- 它没有'如果图像src设置为与之前相同的src,则在WebKit中正确触发
- 它没有正确地冒泡DOM树
- 可以停止为已经存在于浏览器缓存中的图像触发
- It doesn't work consistently nor reliably cross-browser
- It doesn't fire correctly in WebKit if the image src is set to the same src as before
- It doesn't correctly bubble up the DOM tree
- Can cease to fire for images that already live in the browser's cache
这篇关于.load()在ipad上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!