我有这个fiddle,它在mozilla
和chrome
中运行良好,但是当我在IE
中打开它时,跟踪者不再有效了。
这是我的jQuery Code:
var stalker = $('.stalker');
var canvas = $('#canvas')[0];
var ctx = canvas.getContext('2d'), gradient, initialized = false;
$("#container").mousemove(function(e){
setTimeout(function(){
initialized = true;
canvas.width = stalker.width();
canvas.height = stalker.height();
gradient = ctx.createRadialGradient(e.pageX, e.pageY, 0, e.pageX, e.pageY, canvas.width);
gradient.addColorStop(0, stalker.css('border-top-color'));
gradient.addColorStop(1, stalker.css('border-bottom-color'));
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, canvas.width, canvas.height);
}, initialized ? 200 : 0);
});