Christian Corso
Posts: 0
Joined: Thu May 08, 2014 10:45 am

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? Image

Christian Corso
Posts: 0
Joined: Thu May 08, 2014 10:45 am

ADD event to marker maps

plz

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

ADD event to marker maps

Hello,

Please take a look here : https://getsatisfaction.com/apperyio/...

Christian Corso
Posts: 0
Joined: Thu May 08, 2014 10:45 am

ADD event to marker maps

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

ADD event to marker maps

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.

Return to “Issues”