Update HTML5 canvas rectangle on hover

JavascriptWeb DevelopmentFront End Scripts

To update HTML5 canvas rectangle on hover, try to run the following code:

var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.rect(20,20,150,100);
context.stroke();

$(canvas).hover(function(e){
   context.fillStyle = blue;
   context.fill();
});
raja
Published on 11-Apr-2018 07:17:14
Advertisements