0

我尝试在整页画布上放置一个 div。在 Chrome 中效果很好,但在 Firefox 和 ie9 中它会变成“kaput”。

这是该代码的链接(在 Firefox chrome 和 ie9 中尝试过),只有 chrome 似乎可以工作;

http://jsbin.com/ubolan/1/edit

4

1 回答 1

2

在 IE9 文档中没有属性document.width/document.height,因此您将画布宽度/高度设置为 0。

尝试使用

canvas.width = document.body.clientWidth;
canvas.height = document.body.clientHeight;

或者

canvas.width = $(document).width();
canvas.height = $(document).height();
于 2012-10-13T09:46:14.843 回答