Canvas 带有触摸事件的画布阵列
请告诉我如何在第三方js或jquery的帮助下获取特定图像或特定图像id 我的意思是 在画布中,具有数组形式的图像,并希望在特定图像中添加一些警报事件Canvas 带有触摸事件的画布阵列,canvas,html5-canvas,android-canvas,Canvas,Html5 Canvas,Android Canvas,请告诉我如何在第三方js或jquery的帮助下获取特定图像或特定图像id 我的意思是 在画布中,具有数组形式的图像,并希望在特定图像中添加一些警报事件 For Eg.. function draw() { var ctx = document.getElementById('canvas').getContext('2d'), img, i, image_array = []; image_array.push("http://sstatic.net/so/im
For Eg..
function draw() {
var ctx = document.getElementById('canvas').getContext('2d'),
img, i, image_array = [];
image_array.push("http://sstatic.net/so/img/logo.png");
image_array.push("http://www.google.com/intl/en_ALL/images/logo.gif");
image_array.push("http://blog.jimdo.com/wp-content/uploads/2014/01/tree-247122.jpg");
image_array.push("http://chennaionline.com/images/gallery/2013/August/20130622091747/Raja-Rani-Latest-Movie-Stills-Photos-Images-20.jpg");
// ...
for (i = 0; i < image_array.length; i++) {
img = new Image();
img.src = image_array[i];
img.onload = (function(img, i){ // temporary closure to store loop
return function () { // variables reference
ctx.drawImage(img,i*img.width,i*img.height);
}
})(img, i);
}
}
例如,。。
函数draw(){
var ctx=document.getElementById('canvas').getContext('2d'),
img,i,image_数组=[];
图像\u数组。推送(“http://sstatic.net/so/img/logo.png");
图像\u数组。推送(“http://www.google.com/intl/en_ALL/images/logo.gif");
图像\u数组。推送(“http://blog.jimdo.com/wp-content/uploads/2014/01/tree-247122.jpg");
图像\u数组。推送(“http://chennaionline.com/images/gallery/2013/August/20130622091747/Raja-Rani-Latest-Movie-Stills-Photos-Images-20.jpg");
// ...
对于(i=0;i
现在我想在特定图像(logo.gif)。那么你能告诉我
如何获取并在此特定图像上添加事件**