Проблема в том что задача стоит с кастомным маркером, то есть карту формирую кодом
function drawMap(address, iconUrl){
var firstLatlng = new google.maps.LatLng(42.3551142, -71.0594341);
var firstOptions = {
zoom: 19,
center: firstLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
draggable: false,
};
window.map = new google.maps.Map(document.getElementById("contact-google_map"), firstOptions);
geocoder = new google.maps.Geocoder();
geocoder.geocode({'address': address}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var markerLoc = results[0].geometry.location;
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
draggable: false,
icon: iconUrl
});
var loc = 'https://www.google.com.ua/maps/@' + markerLoc.k +',' + markerLoc.B +',19z';
google.maps.event.addListener(marker, 'click', function () {
window.location.href = loc;
});
google.maps.event.addListener(map, 'click', function () {
window.location.href = loc;
});
}
});
}
Я реализовал переход с помощью .addListener, это работает, но при переходе нет маркера, а он нужен.
Кто-нибудь сталкивался с этим ? Как реализовать?