Excanvas.js 在 IE8 中不适用于我

发布于 2024-11-29 10:02:40 字数 1006 浏览 0 评论 0原文

尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忆梦 2024-12-06 10:02:40

您发布的内容看起来不正确,您需要提供更多详细信息,但是我可以说您的很多代码都是多余的。

// Make the <canvas> element.
var canvas = $('<canvas id="ECOTreecanvas" width="2000" height="7000"></canvas>').appendTo($(this.treeContainer));
if (typeof G_vmlCanvasManager != 'undefined') {
    G_vmlCanvasManager.initElement(canvas);
}

我假设您仅在浏览器较旧时才包含 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.

// Make the <canvas> element.
var canvas = $('<canvas id="ECOTreecanvas" width="2000" height="7000"></canvas>').appendTo($(this.treeContainer));
if (typeof G_vmlCanvasManager != 'undefined') {
    G_vmlCanvasManager.initElement(canvas);
}

I am assuming here you only include excanvas when the browser is old.

宫墨修音 2024-12-06 10:02:40

我通过强制事件更新画布元素解决了这个问题。我知道这是一种非正统的机制,但显然使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文