Jump to content

render a prompt box( pop up form..) on google maps doubleclick


Recommended Posts

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

Edited by roberto68
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...