Skip to content

Instantly share code, notes, and snippets.

@PandaTheSlayer
Last active August 8, 2017 16:17
Show Gist options
  • Select an option

  • Save PandaTheSlayer/7a18f69a47e25aaf0eb80f15a24afdde to your computer and use it in GitHub Desktop.

Select an option

Save PandaTheSlayer/7a18f69a47e25aaf0eb80f15a24afdde to your computer and use it in GitHub Desktop.
ITSchool GoogleMaps Markers
function initMap() {
var class1 = new google.maps.LatLng( 46.460123, 30.750629 );
var class2 = new google.maps.LatLng( 46.4593849, 30.7520548 );
var infoWindow = new google.maps.InfoWindow();
var class1Descr = '<h2>Школа Профессионального программирования</h2>' + '' +
'<h3>Одесский Национальный Политехнический Университет</h3>' +
'<p>Главный учебный корпус</p>' +
'<p>Украина, Одесса, прт-т Шевченко 1</p>' +
'<p>ауд. 123</p>';
var class2Descr = '<h2>Школа Профессионального программирования</h2>' + '' +
'<h3>Одесский Национальный Политехнический Университет</h3>' +
'<p>Корпус ИКС/ФАВТ</p>' +
'<p>Украина, Одесса, прт-т Шевченко 1ф</p>' +
'<p>ауд. 705, 706</p>';
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 17,
center: class1,
disableDefaultUI: true
});
var marker1 = new google.maps.Marker({
position: class1,
map: map,
title: 'First Class'
});
var marker2 = new google.maps.Marker({
position: class2,
map: map,
title: 'Second Class'
});
google.maps.event.addListener(marker1, 'click', function () {
infoWindow.setContent(class1Descr);
infoWindow.open(map, this);
});
google.maps.event.addListener(marker2, 'click', function () {
infoWindow.setContent(class2Descr);
infoWindow.open(map, this);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment