1er commit
1er version
This commit is contained in:
62
exclus/gm.js
Normal file
62
exclus/gm.js
Normal file
@@ -0,0 +1,62 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
//var latlng = new google.maps.LatLng(47.087170, 6.713577);
|
||||
/**/
|
||||
var contentString = "<?php echo $title_marker; ?>";
|
||||
var curr_infw;
|
||||
var latlng = new google.maps.LatLng(<?php echo $gm_lat; ?>, <?php echo $gm_lng; ?>);
|
||||
var myOptions = {
|
||||
/* http://code.google.com/intl/fr/apis/maps/documentation/javascript/reference.html#MapOptions */
|
||||
zoom: 11,
|
||||
center: latlng,
|
||||
scrollwheel: true,
|
||||
scaleControl: false,
|
||||
disableDefaultUI: false,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
/*
|
||||
navigationControl: true,
|
||||
navigationControlOptions: {
|
||||
style: google.maps.NavigationControlStyle.SMALL
|
||||
}*/
|
||||
};
|
||||
var map = new google.maps.Map(document.getElementById("map"), myOptions);
|
||||
|
||||
marker = createMarker(latlng, '', contentString, map);
|
||||
|
||||
function createMarker(point, title, content, map) {
|
||||
var myMarkerImage = new google.maps.MarkerImage('http://maps.google.com/mapfiles/arrow.png');
|
||||
var myMarkerShadow = new google.maps.MarkerImage('http://maps.google.com/mapfiles/arrowshadow.png');
|
||||
var marker = new google.maps.Marker({
|
||||
position: point,
|
||||
map: map,
|
||||
icon: myMarkerImage,
|
||||
shadow: myMarkerShadow,
|
||||
title: title
|
||||
});
|
||||
var infowindow = new google.maps.InfoWindow({
|
||||
//content: content
|
||||
content: createInfo(content,content),
|
||||
//width: 500,
|
||||
//height: 400
|
||||
});
|
||||
|
||||
google.maps.event.addListener(marker, 'click', function() { /* mouseover */
|
||||
if(curr_infw) { curr_infw.close();} // We check to see if there is an info window stored in curr_infw, if there is, we use .close() to hide the window
|
||||
curr_infw = infowindow; // Now we put our new info window in to the curr_infw variable
|
||||
infowindow.open(map, marker); // Now we open the window
|
||||
});
|
||||
return marker;
|
||||
};
|
||||
|
||||
// Create information window
|
||||
function createInfo(title, content) {
|
||||
var html = '<div class="infowindow">';
|
||||
html += '<strong>'+ title +'</strong>';
|
||||
html += '<p>'+content+'</p>';
|
||||
html += '<ul><li>Lat: <?php echo $gm_lat; ?></li>';
|
||||
html += '<li>Long: <?php echo $gm_lng; ?></li>';
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user