Excanvas.js 在 IE8 中不适用于我
尝试在 IE8 中实现画布效果。使用excanvas.js在IE7中没有问题,但在IE8中不起作用。该效果名为 ECOTree,我已经完成了所有技巧和所有修改,包括 这里。有什么建议可以在 IE8 中运行此效果吗?
以下是ecotree.js中ie8的修改代码:
// Make the <canvas> element.
var canvas = document.createElement('canvas');
jQuery(canvas).attr('width', 2000).attr('height', 7000).attr('id', 'ECOTreecanvas').appendTo(this.treeContainer);
if ((jQuery.browser.msie) && (parseInt(jQuery.browser.version, 10)<=8)){
// For Internet Explorer, have excanvas initialize the canvas method
// Modification, the major versions greater than 8 don't need excanvas.
canvas.setAttribute('width', '2000');
canvas.setAttribute('height', '7000');
canvas.setAttribute('id', 'ECOTreecanvas');
this.treeContainer.append(canvas);
if (typeof G_vmlCanvasManager != 'undefined') {
canvas = G_vmlCanvasManager.initElement(canvas);
}
}
Trying to make a canvas effect work in IE8. With excanvas.js there is no problem in IE7, but in IE8, it doesn't work. The effect is named ECOTree, and I have made all the tricks and all the modifications included here. Any suggestions to run this effect in IE8?
Here is the modified code for ie8 in ecotree.js:
// Make the <canvas> element.
var canvas = document.createElement('canvas');
jQuery(canvas).attr('width', 2000).attr('height', 7000).attr('id', 'ECOTreecanvas').appendTo(this.treeContainer);
if ((jQuery.browser.msie) && (parseInt(jQuery.browser.version, 10)<=8)){
// For Internet Explorer, have excanvas initialize the canvas method
// Modification, the major versions greater than 8 don't need excanvas.
canvas.setAttribute('width', '2000');
canvas.setAttribute('height', '7000');
canvas.setAttribute('id', 'ECOTreecanvas');
this.treeContainer.append(canvas);
if (typeof G_vmlCanvasManager != 'undefined') {
canvas = G_vmlCanvasManager.initElement(canvas);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您发布的内容看起来不正确,您需要提供更多详细信息,但是我可以说您的很多代码都是多余的。
我假设您仅在浏览器较旧时才包含 excanvas。
Nothing you posted looks incorrect, you will need to provide more detail, however I can say that a lot of your code is redundant.
I am assuming here you only include excanvas when the browser is old.
我通过强制事件更新画布元素解决了这个问题。我知道这是一种非正统的机制,但显然使用 jquery 就绪方法进行更新是不够的
I have solved the problem by forcing an event to update the canvas element. I know it is an unorthodox mechanism but apparently updating with jquery ready method was not enough