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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...