I have follow documentation for creating custom markers in google maps (link) and create code like this (documentation of richmarker (link)):
var locations = [
['LocA', 45.65, 15.2, 4],
['LocB', 45.57, 13.87, 2],
['LocC', 46.05, 14.68, 1],
['LocD', 46.43, 15.75, 5],
['LocE', 46.4, 13.85, 3]
];
setMarkers(map, locations);
function setMarkers(map, location){
for(var i = 0; i < location.length; i++){
var loc = location[i];
var coordinate = new google.maps.LatLng(loc[1], loc[2]);
var marker = new RichMarker({
position: coordinate,
map: map,
zIndex: loc[3],
content:'<div class="myClass">'...+'</div>'
});
}
}
As I understand in zIndex: loc[3] means that it take forth element in array "locations" which is a number in my array (1,2,3,4,5): For example for first (0 row) LocA is name, 45.65 is latitude, 15.2 is longitude, 4 is number of zIndex.
But zIndex in my case is not working. As we can see "LocC" should be in the top of the all markers, than should be followed by "LocB", "LocE", "LocA" and "LocD". But instead the order that is created is: on the top is: LocA, LocB, LocC, LocD, LocE, the order is order from array, so if I put e.g. LocC after LocA in my "locations" array, "LocC" will be on the top. So why is zIndex in my case not working - positions of markers are depending on positions in array?
Tnx for any sugestions.
Aucun commentaire:
Enregistrer un commentaire