I've created a Google Map and added a few markers to it. Each marker has a one-letter label ("A", "B", "C"). I then animate each marker to bounce.
That all works fine with one annoying exception: The labels ("A", "B", "C") don't bounce along with the marker, so it looks odd.
The JS/jQuery is below. I also have a code pen here showing the issue.
Any suggestions on how to have the labels bounce along with the markers?
$(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);
}
});