sgruhier / jquery-addresspicker

JQuery UI widget : address autocomplete field by google maps V3 geocoding service
xilinus.com/jquery-addresspicker/demos/index.html
592 stars 221 forks source link

Click instead of drag #30

Closed ditikos closed 11 years ago

ditikos commented 11 years ago

Hi, is there a way to make the map clickable to the location instead of dragging the marker?

sgruhier commented 11 years ago

you can do something like this

    var gmarker = addresspickerMap.addresspicker( "marker");
    var map     = addresspickerMap.addresspicker( "map");
    google.maps.event.addListener(map, "click", function(position) {
      gmarker.setPosition(position.latLng);
      google.maps.event.trigger(gmarker, "dragend");
    })
thomasa1980 commented 8 years ago

I was unable to make this work, has this changed?