I am quite new in JavaScript. I found a code that zoom an image.My question is how will add pinch event on below JavaScript code so the image will scale base on pinch?
Here is the HTML code
<html>
<body>
<map id="map" name="map">
<area coords="15,92,568,247" alt="Blah" href="javascript:alert('hello');" />
<area coords="18,259,546,432" alt="Blah" href="javascript:alert('hello 2');" />
</map>
<input type="button" value="+" onclick="javascript:ZoomIn();"/>
<input type="button" value="-" onclick="javascript:ZoomOut();"/><br />
<img src="Highlight cells.png" usemap="#map" id="image" />
Javascript Code
function ZoomIn() {
Zoom(1.1);
}
function ZoomOut() {
Zoom(0.9);
}
function Zoom(amount) {
// resize image
var image = document.getElementById('image');
image.height = image.height * amount;
// resize image map
var map = document.getElementById('map');
for (var i = 0; i < map.areas.length; i++) {
var area = map.areas[i];
var coords = area.coords.split(',');
for (var j = 0; j < coords.length; j++) {
coords[j] = coords[j] * amount;
}
area.coords = coords[0] + ',' + coords[1] + ',' + coords[2] + ',' + coords[3];
}
}