Ich hoffe, dass jemand mir freundlicherweise helfen kann. Ich habe nicht das ausreichende Wissen von Google API und Jquery, um zu implementieren, was ich brauche.Google map listing ähnlich wie Airbnb
ich eine Google-Karte haben, können Sie eine Demo sehen hier http://divinethemes.eu/map/ das Skript arbeitet mit infobox, wobei jeder Punkt durch eine Kategorie gefiltert, usw.
Was ich brauche, ist die Möglichkeit zu haben, einige Aktionen zu geben aus einer externen Kartenliste (aus dem HTML): öffne die Blase eines bestimmten Punktes (und schließe bereits geöffnet + zentriere die Karte) oder hüpfe eine Blase oder markiere einen bestimmten Marker. Meine Absicht ist es, eine ähnliche (einfachere) Google Map Location Liste wie Airbnb zu erstellen. kann toll sein, wenn in der HTML-Auflistung außerhalb der Karte jeder Punkt ein href sein kann, der die spezifische Blase via und ID oder Datenattribut öffnet ... wie "name_point". aber ich weiß nicht, wie es zu tun ...
Hier ist der Code der Karte:
(function(A) {
if (!Array.prototype.forEach)
A.forEach = A.forEach || function(action, that) {
for (var i = 0, l = this.length; i < l; i++)
if (i in this)
action.call(that, this[i], i, this);
};
})(Array.prototype);
var
mapObject,
markers = [],
markersData = {
'Bars': [
{
type_point: 'Wine bar',
location_latitude: 43.773781,
location_longitude: 11.257206,
map_image_url: 'img/thumb_map_2.jpg',
rate: 'Superb 7.5',
name_point: 'Astor Cafe',
description_point: 'Piazza del Duomo, 20/R',
get_directions_start_address: '43.773460, 11.255985',
phone: '+3934245255',
url_detail: 'single_tour.html'
},
{
type_point: 'Pub - Wine bar',
location_latitude: 43.772238,
location_longitude: 11.252205,
map_image_url: 'img/thumb_map_3.jpg',
rate: 'Superb 7.5',
name_point: 'Uncle Jimmy',
description_point: 'Via dei Pescioni,10',
get_directions_start_address: '43.773460, 11.255985',
phone: '+3934245255',
url_detail: 'single_tour.html'
}
]
};
var mapOptions = {
zoom: 16,
center: new google.maps.LatLng(43.773460, 11.255985),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
position: google.maps.ControlPosition.LEFT_CENTER
},
panControl: false,
panControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.TOP_RIGHT
},
scrollwheel: false,
scaleControl: false,
scaleControlOptions: {
position: google.maps.ControlPosition.TOP_LEFT
},
streetViewControl: true,
streetViewControlOptions: {
position: google.maps.ControlPosition.LEFT_TOP
},
};
var marker;
mapObject = new google.maps.Map(document.getElementById('map'), mapOptions);
for (var key in markersData)
markersData[key].forEach(function (item) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(item.location_latitude, item.location_longitude),
map: mapObject,
icon: 'img/pins/' + key + '.png',
});
if ('undefined' === typeof markers[key])
markers[key] = [];
markers[key].push(marker);
google.maps.event.addListener(marker, 'click', (function() {
closeInfoBox();
getInfoBox(item).open(mapObject, this);
mapObject.setCenter(new google.maps.LatLng(item.location_latitude, item.location_longitude));
}));
});
function hideAllMarkers() {
for (var key in markers)
markers[key].forEach(function (marker) {
marker.setMap(null);
});
};
function closeInfoBox() {
$('div.infoBox').remove();
};
function getInfoBox(item) {
return new InfoBox({
content:
'<div class="marker_info" id="marker_info">' +
'<img src="' + item.map_image_url + '" alt=""/>' +
'<span>'+
'<span class="infobox_rate">'+ item.rate +'</span>' +
'<h3>'+ item.name_point +'</h3>' +
'<em>'+ item.type_point +'</em>' +
'<strong>'+ item.description_point +'</strong>' +
'<a href="'+ item.url_detail + '" class="btn_infobox_detail"></a>' +
'<form action="http://maps.google.com/maps" method="get" target="_blank"><input name="saddr" value="'+ item.get_directions_start_address +'" type="hidden"><input type="hidden" name="daddr" value="'+ item.location_latitude +',' +item.location_longitude +'"><button type="submit" value="Get directions" class="btn_infobox_get_directions">Get directions</button></form>' +
'<a href="tel://'+ item.phone +'" class="btn_infobox_phone">'+ item.phone +'</a>' +
'</span>' +
'</div>',
disableAutoPan: true,
maxWidth: 0,
pixelOffset: new google.maps.Size(35, -175),
closeBoxMargin: '5px -28px 0 0',
closeBoxURL: "img/close_infobox.png",
isHidden: false,
pane: 'floatPane',
enableEventPropagation: true
});
};
Mögliches Duplikat von [Google Maps, öffnen Sie das Informationsfenster nach dem Klicken auf einen Link] (http://stackoverflow.com/que stions/18333679/google-maps-open-info-window-nach-click-on-a-link) – MrUpsidown
Mögliche Duplikate von [Google Maps v3 öffnen Infowindow von einem Link außerhalb der Karte] (http://stackoverflow.com/ Fragen/9078464/google-maps-v3-open-infowindow-from-a-link-außerhalb der Karte) – MrUpsidown