imagemap is a Javascript library for work with image as map. jQuery is required. It is possible to zoom on image and create clickable markers. See the demonstrations.
0.0.5.0
www.safeprk.com.br/imagemap/imageMap.html
- Import JQuery
<script type="text/javascript" src="jquery.min.js"></script>
- Import ImageMap javascript file
<script type="text/javascript" src="imageMap.js"></script>
- Creating a map
var map = new imagemap.Map({
container: 'map',
image: 'path/to/image/map_image.png',
size: [4660, 3050],
zoom: 9,
nivel: 19
});
Atribute | Explanation |
container | Div to create map |
image | Path to image |
size | Image original size [ width, height ] |
zoom | Zoom image start |
nivel | Max zoom level |
- Creating a marker
var marker1 = map.addMarker({
image: 'marker_red.png',
position: [680, 720]
});
Atribute | Explanation |
image | Makert path to image |
position | Marker position on original image [ left, top ] |
width | Marker width |
height | Marker height |
reference | Users value control |
description | Users description |
onclick | Marker onclick event |
- Update a marker
map.updateMarker({
id: markerSelected.id,
image: "path/to/new_image.png",
width: 20,
height: 20
});
Atribute | Explanation |
image | Makert path to image |
position | Marker position on original image [ left, top ] |
width | Marker width |
height | Marker height |
onclick | Marker onclick event |
- Remove a marker
map.removeMarker(markerSelected.id);
Atribute | Explanation |
id | Id marker |
Fernando Moralles