Tell me how such a thing is realized: There is a block where a city is selected, for example, Moscow and London. And I need to 1) specify an office label in each city 2) when you click on a city (in a block) move to a specific label
thank
Tell me how such a thing is realized: There is a block where a city is selected, for example, Moscow and London. And I need to 1) specify an office label in each city 2) when you click on a city (in a block) move to a specific label
thank
To do this, use the Google Maps API Markers.
It's pretty simple, here is a sample code:
// ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ Π³ΡΠ³Π»ΠΎΠΊΠ°ΡΡΡ var map = new google.maps.Map(document.getElementById('map'), { // ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΠΈ ΠΊΠ°ΡΡΡ }); // ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ - ΠΊΠΎΠΎΡΠ΄ΠΈΠ½Π°ΡΡ ΠΎΡΠΈΡΠ° // lat - ΡΠΈΡΠΎΡΠ° // lng - Π΄ΠΎΠ»Π³ΠΎΡΠ° function chnangePositionOnMap(lat, lng) { var myLatLng = {lat: lat, lng: lng}; /* ΡΡΠΎ ΡΡΠΎΠ±Ρ ΠΏΠΎΡΡΠ°Π²ΠΈΡΡ ΠΌΠ°ΡΠΊΠ΅Ρ Π΅ΡΠ»ΠΈ Π½ΡΠΆΠ½ΠΎ var marker = new google.maps.Marker({ position: myLatLng, map: map, title: 'ΡΠ΅ΠΊΡΡ ΠΌΠ°ΡΠΊΠ΅ΡΠ°' }); */ // Π° ΡΡΠΎ ΡΡΠΎΠ±Ρ ΠΏΠ΅ΡΠ΅ΠΉΡΠΈ ΠΊ Π΄Π°Π½Π½ΡΠΌ ΠΊΠΎΠΎΡΠ΄ΠΈΠ½Π°ΡΠ°ΠΌ Π½Π° ΠΊΠ°ΡΡΠ΅ map.setCenter(myLatLng); } Source: https://ru.stackoverflow.com/questions/707790/
All Articles