ADD event to marker maps
i have just finish this guide http://devcenter.appery.io/tutorials/... and i have the maps with 3 marker how i can add event in the marker to navigate in another app page?
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
i have just finish this guide http://devcenter.appery.io/tutorials/... and i have the maps with 3 marker how i can add event in the marker to navigate in another app page?
plz
Hello,
Please take a look here : https://getsatisfaction.com/apperyio/...
i follow the post and now my code is:
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: 5,
center: new google.maps.LatLng((maxLatitude + minLatitude) / 2, (maxLongitude + minLongitude) / 2),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var BindMarker = function(marker, pageNagivateTo){
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 = pageNagivateTo ? pageNagivateTo : "Menuita";
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: 'Modello Toyota (Chubu)',
});
BindMarker(marker, "Menuita");
}
but all 3 marker open the same page.
how do I open different pages by individual markers?
Hi Christian,
This is because you set the same page for each marker:preBindMarker(marker, "Menuita");/preYou should pass different values for each marker in the second function parameter.