roberto68 Posted March 6, 2015 Share Posted March 6, 2015 (edited) 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 March 6, 2015 by roberto68 Link to comment Share on other sites More sharing options...
justsomeguy Posted March 6, 2015 Share Posted March 6, 2015 Are you checking for Javascript error messages? Does the double click event fire? Which part are you having a problem with? Link to comment Share on other sites More sharing options...
roberto68 Posted March 6, 2015 Author Share Posted March 6, 2015 (edited) no I do not have any error, when I doubleclick it only zooms in, I put alert box right after placeMarker but no alert appears , ok so i change dbclick to click and it works Edited March 7, 2015 by roberto68 Link to comment Share on other sites More sharing options...
justsomeguy Posted March 6, 2015 Share Posted March 6, 2015 Is "dbclick" the correct name for the event? Link to comment Share on other sites More sharing options...
roberto68 Posted March 7, 2015 Author Share Posted March 7, 2015 https://developers.google.com/maps/documentation/javascript/events#EventArguments and yeah I read the intro at the top of that page dbclick is valid event Link to comment Share on other sites More sharing options...
Ingolme Posted March 7, 2015 Share Posted March 7, 2015 It's dblclick with an L. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now