1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
function init() {
var myOptions = {
zoom: 3,
center: new google.maps.LatLng(40, 4.490381),
mapTypeId: google.maps.MapTypeId.HYBRID,
mapTypeControl: false,
streetViewControl: false,
panControl: true,
panControlOptions: {
position: google.maps.ControlPosition.LEFT_CENTER
},
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_CENTER
},
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
/* lieux */
var premLatLng = new google.maps.LatLng(45.768047,4.817795);
/* perso*/
var deuzLatLng = new google.maps.LatLng(46.22764,2.21375);
/* icons */
var perso_img = 'img/perso.png';
var flag_prem= 'img/flag_ensba.png';
var shape_prem = { coord: [43, 0, 86, 30], type: 'rect' };
/* prem */
var premMarker = new google.maps.Marker({
position: premLatLng,
map: map,
title: "premier",
icon: flag_prem,
shape: shape_prem
});
var contentString = '<h3>Premier marker</h3>';
var infowindow = new google.maps.InfoWindow({
content: contentString,
});
google.maps.event.addListener(ensbaMarker, 'click', function() {
infowindow.setZIndex( ++zIndexWindow); // mise sur le dessus
infowindow.open(map,premMarker);
});
/* deuz */
var deuzMarker = new google.maps.Marker({
position: deuzLatLng,
map: map,
title:"deuz",
icon: perso_img
});
var contentString_deuz= '<div>second marker</div>';
var infowindow_deuz = new google.maps.InfoWindow({
content: contentString_deuz
});
google.maps.event.addListener(deuzMarker, 'click', function() {
infowindow.setZIndex( ++zIndexWindow); // mise sur le dessus
infowindow_deuz.open(map,deuzMarker);
});
} |
Partager