97
rated 0 times
[
101]
[
4]
/ answers: 1 / hits: 66943
/ 9 Years ago, fri, march 27, 2015, 12:00:00
I've got some code which draws a rectangle on a canvas, but I want that rectangle to change color when I hover the mouse over it.
The problem is after I've drawn the rectangle I'm not sure how I select it again to make the adjustment.
What I want to do:
var c=document.getElementById(myCanvas);
var ctx=c.getContext(2d);
ctx.rect(20,20,150,100);
ctx.stroke();
$('c.[rectangle]').hover(function(this){
this.fillStyle = 'red';
this.fill();
});
More From » html