Javascript-форум (https://javascript.ru/forum/)
-   Элементы интерфейса (https://javascript.ru/forum/dom-window/)
-   -   Маркер google maps (https://javascript.ru/forum/dom-window/52071-marker-google-maps.html)

Anario 03.12.2014 09:56

Маркер google maps
 
добрый день уважаемые.

прошу подсказать как добавить несколько маркеров в данный код для google maps. Это мой кусок кода который показывает локацию моего место положения , но хотелось бы добавить несколько маркеров.

Спасиб зарание.

<script type="text/javascript">
		
		var map;
	
		
		function initialise(location)
		{
			console.log(location);
			
			
			var currentLocation = new google.maps.LatLng(location.coords.latitude, location.coords.longitude);
			
			var mapOptions = {
				center: currentLocation,
				zoom: 12,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			};
			
			map = new google.maps.Map(document.getElementById("map-canvas"),
					mapOptions);
					
			var marker = new google.maps.Marker({
				position: currentLocation,
				map: map
			});
		}	
		
		$(document).ready(function()
		{
			navigator.geolocation.getCurrentPosition(initialise);
		});
		
	</script>

myshara 03.12.2014 18:50

Привет!

Читаем: API Google Maps


Часовой пояс GMT +3, время: 02:31.