jQuery IE兼容性问题

时间:2016-03-02 01:53:29

标签: javascript jquery html css

我有这个fiddle,它在mozillachrome中运行良好,但是当我在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);
});

0 个答案:

没有答案