Closed LoeiFy closed 8 years ago
image 通过 ajax 方式加载,加载完成调用 drawImage 方法,chrome 完成 canvas 图片,但是 firefox 却 canvas 空白,Google 一下 Try calling the drawImage function inside the image's load function to ensure that the image is actually loaded before trying to draw it.
Try calling the drawImage function inside the image's load function to ensure that the image is actually loaded before trying to draw it.
image.onload = function() { // context.drawImage... }
但这样做可能再次打开页面,drawImage 不会发生,原因是 image 可能不触发 onload,而是 complete,所以
image.onload = function() { // context.drawImage... } if (image.complete) image.onload();
image 通过 ajax 方式加载,加载完成调用 drawImage 方法,chrome 完成 canvas 图片,但是 firefox 却 canvas 空白,Google 一下
Try calling the drawImage function inside the image's load function to ensure that the image is actually loaded before trying to draw it.
但这样做可能再次打开页面,drawImage 不会发生,原因是 image 可能不触发 onload,而是 complete,所以