- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Update HTML5 canvas rectangle on hover
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(); });
- Related Articles
- How to draw a rectangle on HTML5 Canvas?
- HTML5 Canvas Font Size Based on Canvas Size
- addEventListener for keydown on HTML5 Canvas
- World Map on HTML5 Canvas or SVG
- Play video on canvas and preserve the last frame/image on HTML5 Canvas
- How to clear a chart from HTML5 canvas so that hover events cannot be triggered?
- How to detect point on canvas after canvas rotation in HTML5
- Drawing an SVG file on an HTML5 canvas
- Measure text height on an HTML5 canvas element
- Is HTML5 canvas and image on polygon possible?
- Enhance real-time performance on HTML5 canvas effects
- How to draw large font on HTML5 Canvas?
- How to draw a rounded Rectangle on HTML Canvas?
- Translating HTML5 canvas
- HTML5 Canvas distorted

Advertisements