在 HTM5 上製作滑鼠移過的圖象縮放
要使圖片在滑鼠懸停時縮放,請使用原生 JavaScript 庫。
對於滑鼠移動,要設定如下內容
function move(e) {
var pos = getMousePos(myCanvas, e);
context.drawImage(img, -pos.x, -pos.y, img.width, img.height);
}對於畫布
//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);
}
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP