canvas not working in ie8 browsers

  • My canvas not working in ie8 i include explorer canvas js file and included the script tag in my html... i downloaded from this link https://code.google.com/p/explorercanvas/downloads/list can you guys tell me how to fix this bug... providing my code below...or is there a way to fix the bug

http://jsfiddle.net/fHmA8/1/

<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script type="text/javascript" src="http://www.craftygnome.com/fixes/excanvas.js"></script><![endif]-->
var animate = function() {
        canvas.width = canvas.width;    //clear canvas

        percent += STEP_PERCENT;    //increase percentage
        var deg = percent / 100 * deg360;   //calculate current position in radians

        drawArc('#aaa', radius, deg360, null, true);    //draw grey background (last parameter - true - draw shadow)
        drawArc('#0e728e', radius, deg);                //draw light blue
        for (var i = 0, n = Math.floor(deg / deg60); i < n; i++) {  //draw segments (as I understand segment drawing works not exactly as you want so you can delete this code)
            var from = i * deg30 + deg1;
            var to = from + deg30 - deg1 * 2;
            drawArc('#250696', radius, to, from);
        }

        if (percent >= 100) {
            //done
        } else {
            setTimeout(animate, STEP_DELAY);    //next step in STEP_DELAY ms
        }
    }

Answers


You may need to initialize the canvas depending on when it is created. You can do that by calling these lines -

After obtaining the "canvas" element in the top of the script:

// initialize if excanvas
if (typeof G_vmlCanvasManager !== 'undefined')
    G_vmlCanvasManager.initElement(canvas);

// now this should work
var ctx = canvas.getContext('2d');

... continue code here...

Need Your Help

Python Prime Number Set

python numbers

I'm trying to write a program which will print out all the prime numbers for a given set of numbers. When I run the program written below, the shell returns 2 and 3 and nothing further. What in my

Using Composite Key Or Unique Constraint to prevent row duplicate

sql-server tsql

My table and data looks like this: This data is being mine from Archive.