Thanks for this, I have it working in a sense, but all my markers navigate to the same 'screen 10'. At the moment I have 3 markers that I would like to take me to a specific page each after a click through.
I added the code to my 'convertAddr' results response:
code
function log2(m) {
return ((Math.log(m)) / (Math.log(2)));
};
for (var k in value.geometry) {
if (locationHelper.checkLocation(k)) {
locationHelper.aLocations.push([value.geometry.location.lat, value.geometry.location.lng]);
}
}
var maxLatitude = -90,
minLatitude = 90,
maxLongitude = -180,
minLongitude = 180;
for (i = 0; i < locationHelper.aLocations.length; i++) {
maxLatitude = locationHelper.aLocations[0] > maxLatitude ? locationHelper.aLocations[0] : maxLatitude;
minLatitude = locationHelper.aLocations[0] < minLatitude ? locationHelper.aLocations[0] : minLatitude;
maxLongitude = locationHelper.aLocations[1] > maxLongitude ? locationHelper.aLocations[1] : maxLongitude;
minLongitude = locationHelper.aLocations[1] < minLongitude ? locationHelper.aLocations[1] : minLongitude;
}
var map = new google.maps.Map(document.getElementsByName("multiGoogleMap")[0], {
zoom: 15,
center: new google.maps.LatLng((maxLatitude + minLatitude) / 2, (maxLongitude + minLongitude) / 2),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var contentString = "Text Text"
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var BindMarker = function(marker){
google.maps.event.addListener(marker, 'click', function() {
//Here is a code to specify page you want to navigate. You need to get it from marker or other way(from some data).
var nextPage = "Screen10"
Apperyio.navigateTo(nextPage);
});
};
var marker, i;
for (i = 0; i < locationHelper.aLocations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locationHelper.aLocations[0], locationHelper.aLocations[1]),
map: map,
title: 'Uluru (Ayers Rock)'
});
BindMarker(marker);
};
/code
I'm guessing I'm not defining each marker properly? Really appreciate your guidance.
Thanks
Craig