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
| <!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>[Google Maps API V3] Custom Style Carte</title>
<meta name="Author" content="NoSmoking">
<style type="text/css">
html, body {
font-family : Verdana, Arial;
font-size : 1em;
margin : 10px;
padding : 0px;
}
h1 {
color : #4488bb;
font-size : 1.3em;
border : 1px solid #4488bb;
padding : 10px;
}
h1 span{
font-size : .8em;
font-style : italic;
}
#page {
margin : auto;
width : 800px;
}
#div_carte{
margin : auto;
margin-top : 20px;
width : 600px;
height: 600px;
border : 1px solid #c0c0c0;
}
</style>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initCarte(){
// definition du style a appliquer
var mapStyles =
[
{
featureType: "road",
stylers: [
{ visibility: "off" }
]
}
];
// creation de la carte
var oMap = new google.maps.Map( document.getElementById( 'div_carte'),
{
'zoom' : 6,
'center' : new google.maps.LatLng( 46.80, 1.70),
'disableDefaultUI' : true,
'zoomControl' : true,
'zoomControlOptions': {
style: google.maps.ZoomControlStyle.SMALL
},
'styles' : mapStyles,
'mapTypeId' : google.maps.MapTypeId.ROADMAP
}
);
}
google.maps.event.addDomListener(window, 'load', initCarte);
</script>
</head>
<body>
<div id="page">
<h1><span>[Google Maps API V3]</span> Custom Style Carte</h1>
<div id="div_carte"></div>
</div>
</body>
</html> |
Partager