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 70 71 72 73 74 75 76 77 78
| <!DOCTYPE html>
<html lang="fr">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>...</title>
<style type="text/css">
html, body {
height : 100%;
margin: 0;
padding : 0;
}
#div_map{
margin : auto;
margin-top:50px;
width : 600px;
height: 600px;
border : 1px solid #808080;
}
</style>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function createImage(){
var larg = 218, haut = 90;
var oImg = new google.maps.MarkerImage(
// URL image
'http://www.developpez.net/template/images/logo.png',
// SIZE Taille Image
new google.maps.Size( larg, haut),
// ORIGIN Origine Image 0,0, utile si utilisation de sprite
new google.maps.Point(0,0),
// ANCHOR Position d'accrochage sur la Map
new google.maps.Point( larg/2, haut/2)
);
return oImg;
}
function initCarte(){
var ptCentre = new google.maps.LatLng( 46.80, 1.70);
var oMap = new google.maps.Map(document.getElementById('div_map'),{
'zoom' : 6,
'center' : ptCentre,
'streetViewControl' : false,
'mapTypeControl' : false,
'zoomControlOptions' : {
'style' : google.maps.ZoomControlStyle.SMALL
},
'mapTypeId' : google.maps.MapTypeId.ROADMAP
});
var oMarker = new google.maps.Marker({
'position' : ptCentre,
'map' : oMap
});
var oImage = new google.maps.Marker({
'icon' : new createImage(),
'position' : ptCentre,
'map' : null
});
// garde adresse de l'image
oMarker.image = oImage;
google.maps.event.addListener( oMarker, 'mouseover', function(){
this.image.setMap( this.getMap());
});
google.maps.event.addListener( oMarker, 'mouseout', function(){
this.image.setMap( null);
});
}
google.maps.event.addDomListener(window, 'load', initCarte);
</script>
</head>
<body>
<div id="div_map"></div>
</body>
</html> |
Partager