my approach is simple want a prompt box apper on doubleclick on google maps : user clicks yes (some form is rendered, another page - for now alert box appears) if no nothing.. but my code doesn't do teh work
google.maps.event.addListener(map, 'dbclick', function(event) {placeMarker(event.latLng,"addEvents.html"); }); function placeMarker(location, page) {// render pop up box, to add event or cancel if (confirm("Press a button!") == true) { alert ("You pressed OK!"); // render pop up form //window.location.replace(page); // podla toho ci event or place var marker = new google.maps.Marker({ position: location, map: map }); map.setCenter(location); } else { alert ("cancel adding event"); // chcem pridat event } }
the listener is placed inside this function (it finds wether geolocation is OK and if so it centers to the current postiion
if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) {
I also add alert box inside this function - the alert box appears without problems