Ho creato una mappa di Google e ho aggiunto alcuni indicatori. Ogni marcatore ha un'etichetta di una sola lettera ("A", "B", "C"). Quindi animare ciascun marker per rimbalzare.API di Google Maps - Perché le etichette non vengono animate insieme ai marcatori?
Che tutto funzioni correttamente con una fastidiosa eccezione: le etichette ("A", "B", "C") non rimbalzano insieme al marcatore, quindi sembra strano.
Il JS/jQuery è sotto. I also have a code pen here showing the issue.
Qualche suggerimento su come far rimbalzare le etichette insieme ai marcatori?
$(function() {
var map;
var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var labelIndex = 0;
var markers = [];
// Map locations
var mapLocations = [{
"name": "Windwood Hollow Park",
"description": "This is the description for location 1",
"position": {
"lat": 33.942253,
"lng": -84.278242
}
}, {
"name": "Peeler Road Linear Park",
"description": "This is the description for location 2",
"position": {
"lat": 33.940143,
"lng": -84.278394
}
}, {
"name": "Winters Chapel Animal Hospital",
"description": "This is the description for location 3",
"position": {
"lat": 33.940707,
"lng": -84.272021
}
}];
map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: 33.943345,
lng: -84.280186
},
zoom: 15
});
for (var j = 0; j < mapLocations.length; j++) {
var currentLabel = labels[labelIndex++ % labels.length];
// Create a map marker
var marker = new google.maps.Marker({
position: mapLocations[j].position,
map: map,
title: mapLocations[j].name,
label: currentLabel
});
marker.setAnimation(google.maps.Animation.BOUNCE);
}
});
ho notato che pure. Probabilmente è necessario aprire un problema nel [issue tracker] (https://code.google.com/p/gmaps-api-issues/). Correzione – geocodezip
. Esiste un [numero aperto ("PendingReview") numero # 8573] (https://code.google.com/p/gmaps-api-issues/issues/detail?id=8573) dal 6 settembre 2015. – geocodezip
A "soluzione" sarebbe utilizzare i propri marcatori con quella lettera al suo interno o crearli "al volo" con una manipolazione di immagini di backend. Forse qualche ispirazione qui: http://stackoverflow.com/a/20778505/1238965 – MrUpsidown