Search code examples
javascriptcanvasinternet-explorer-8excanvas

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 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);
    }
}

Solution

  • 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