问题
JQuery Knob not working in IE 8. If you look at the site http://anthonyterrien.com/knob/ you'll see the problem. Comparability mode does not seem to work either. Any suggestions ?
回答1:
Just adding a bit more information to user2147420's answer, you can get excanvas.js here https://code.google.com/p/explorercanvas/downloads/detail?name=excanvas_r3.zip
There are examples with that download but if you want a quick view of how to use it, here is a lnk for that https://code.google.com/p/explorercanvas/wiki/Instructions
Just add this in the head section your html.
<!--[if lt IE 9]>
<script src="pathToFile/excanvas.js"></script>
<![endif]-->
Note - the page I pointed to above says: "If you have created your canvas element dynamically it will not have the getContext method added to the element. To get it working you need to call initElement on the G_vmlCanvasManager object."
i.e. add this code to the appropriate place in the jquery knob javascript file
var el = document.createElement('canvas');
G_vmlCanvasManager.initElement(el);
var ctx = el.getContext('2d');
回答2:
I don't have enough rep to comment on TheGooch's answer so I have to add this as an answer, sorry about that.
I have found that jQuery Knob 1.2.11 already has the code inside it to attempt to load excanvas if the excanvas library is loaded and the jQuery Knob library has been unable to instantiate a Canvas element.
So all you need to do now is add the conditional include in your head like TheGooch mentioned and everything should be sorted on IE8.
来源:https://stackoverflow.com/questions/14743161/jquery-knob-not-working-in-ie-8