开发者

Excanvas.js doesn't work for me in IE8

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 开发者_StackOverflow中文版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);
    }
}


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜