![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Making an image scale mouse over on HTM5
To make an image scale on mouse over, use Vanilla JavaScript library.
On mouse move, set it like the following:
function move(e) { var pos = getMousePos(myCanvas, e); context.drawImage(img, -pos.x, -pos.y, img.width, img.height); }
For canvas:
//add event listener we need myCanvas.addEventListener('mouseout', display, false); myCanvas.addEventListener('mousemove', move, false);
function display() { context.drawImage(img, 0, 0, img.width>>1, img.height>>1); }
Advertisements