Я хочу интегрировать карту Google в HTML с несколькими местоположениями. Проблема в том, что когда я нажимаю кнопку местоположения, местоположение меняется, и маркер появляется в точке, но информационное окно не появляется на маркере. когда я нажимаю на маркер, информационное окно появляется во всплывающем окне. Поэтому мне нужно, когда я нажимаю кнопку selecteor, маркер и информационные окна появляются сразу, и карта должна быть увеличена. для справки прилагаются изображения Javascript и HTML, пожалуйста, помогите, как я могу это сделать?
<div class="col-sm-1hlaf col-md-1half text-left" style="padding-left: 0px; margin-top:20px;">
<h3 style="font-size: 2rem; color: #ffffff; font-weight: bold; margin-bottom: 2px;"> Head Office</h3>
<button type="button" class="btn btn-link" id="abudhabi">Abu Dhabi, UAE
var map;
function initialize() {
map = new google.maps.Map(document.getElementById('map-canvas'), {
zoom: 18,
center: new google.maps.LatLng(24.4850983,54.3645303)
});
}
function newLocation(newLat,newLng)
{
map.setCenter({ lat : newLat, lng : newLng,});
var marker = new google.maps.Marker({
position: new google.maps.LatLng(newLat,newLng), map: map, });
var contentString =
'<h3 >Uluru</h3>'+
'<p >Abcedeer</p>'+
'</div>';
var infowindow = new google.maps.InfoWindow({ content: contentString });
marker.addListener('click', function() { infowindow.open(map, marker); });
}
google.maps.event.addDomListener(window, 'load', initialize);
//Setting Location with jQuery
$(document).ready(function ()
{
$("#abudhabi").on('click', function () {newLocation(24.4850983,54.3645303);});
$("#dubai").on('click', function (){newLocation(25.1148601,55.1949989);});
$("#ksa").on('click', function () {newLocation(25.2642846,51,5155031);});
$("#jordan").on('click', function (){newLocation(31.8360368,35.6674318); });
$("#Seychelles").on('click', function (){newLocation(-4.6223488,55.4485224);});
$("#algeria").on('click', function (){newLocation(36.7538345,3.0534636); });
});
<head>
<link> herf="https://stackpath.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"</link>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBu-916DdpKAjTmJNIgngS6HL_kDIKU0aU&callback=myMap"></script>
</head>
<body>
<div class="col-sm-1hlaf col-md-1half text-left" style="padding-left: 0px; margin-top:20px;">
<h3 style="font-size: 2rem; color: #ffffff; font-weight: bold; margin-bottom: 2px;"> Head Office</h3>
<button type="button" class="btn btn-link" id="abudhabi">Abu Dhabi, UAE</button>
<h3 style="font-size: 2rem; color: #ffffff; font-weight: bold; margin-bottom: 2px;"> Regional Offices</h3>
<button type="button" class="btn btn-link" id="dubai">Dubai</button><br/>
<button type="button" class="btn btn-link" id="ksa">KSA</button><br/>
<button type="button" class="btn btn-link" id="jordan">Jordan</button><br/>
<button type="button" class="btn btn-link" id="Seychelles">Seychelles</button><br/>
<button type="button" class="btn btn-link" id="algeria">Algeria</button> <br/>
<button type="button" class="btn btn-map btn-sm" onclick="openWin()" value="print a map" style="margin-top:54px;">Print Map</button>
</div>
<div class="col-md-6 col-sm-6" id="myMap">
<div style="width:100%; height:345px; margin: 40px 0 0 0;" id="map-canvas"></div>
</div>
</body
Региональные офисы
Дубай
КСА
Джордан
Сейшелы
Алжир
Печать карты
Спасибо! Уважаемый @hikarunomemory за вашу поддержку, я благодарен вам за поддержку. Немного больше помощи от вас, на самом деле я хочу, чтобы установить адреса каждой кнопки местоположения во всплывающем окне информационного окна. как я могу это изменить?
Очень Очень Благодарен Вам... Работает Ура! Люблю<3 и ценю вашу любезную поддержку...