Skip to content

Instantly share code, notes, and snippets.

Created May 13, 2015 07:50
Show Gist options
  • Save anonymous/9e08846994f2e709dd37 to your computer and use it in GitHub Desktop.
Save anonymous/9e08846994f2e709dd37 to your computer and use it in GitHub Desktop.
グラフなど、画像の一部分にクリックイベントを与えたい場合はクリッカブルマップを使う [add your bin description] // source http://jsbin.com/nadateboja
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
<meta charset="utf-8">
<title>グラフなど、画像の一部分にクリックイベントを与えたい場合はクリッカブルマップを使う</title>
</head>
<body>
<h1>javascript部分をクリック</h1>
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQuZeG8oaTSnTU54U--7MaE7ZRq8fgi_La3MCaacBG3o3taZjcO" alt="" border="0" usemap="#Map" width="100%"/>
<map name="Map" id="Map">
<area id="Area1" shape="poly" coords="548,390,314,585,313,605,399,643,498,659,618,661,617,638" href="javascript:void(0)" alt="" />
</map>
<script>
document.getElementById('Area1').addEventListener('mousedown',function(){
alert("人気です");
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment