javascript - How can i set the new position of marker with Gmaps.js? -
with gmaps.js can add markers easy way:
map.addmarker({ lat: -12.043333, lng: -77.028333 });
after create marker, want set him new position after time. example next code:
setinterval(function() { setnewposition(); }, 5000); setnewposition(){ map.removemarkers(); map.addmarker({ lat: -13.043333, lng: -77.028333 }); }
but don`t want time removed marker, want set him new position. possible? know in google map solved google.maps.latlng() , .setposition(), how in gmaps.js used?
as far know there no special method set position.
addmarker()
returns native google.maps.marker
, may store marker in variable , call setposition()
later.
Comments
Post a Comment