i want to move marker after some interval on map..
i have following code for markers that set with interval of 3 second and also set polyline between those markers..
but i want to show direction between those marker and also in infoWindow ,latitude and longitude of that marker is display...
means at place A lat-log of a will be shown in infoWindow..
here is my code...thank u for help !!!!
var locations=[
['19.0018014','72.914170300']'
['18.4915595','73.886065199'],
['17.5272371','75.957780299'],
['19.0787678','75.752507899'],
['19.9971895','73.916395800'],
['21.16536','72.79387']
];
var map;
var NewLatLng=[];
var NewLatLng1=[]
var markers=[];
var marker ;
function initialize()
{
var latlng = new google.maps.LatLng(21.16536,72.79387);
var myOptions = {
zoom: 5,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map"), myOptions);
map = new google.maps.Map(document.getElementById("map"), myOptions);
marker = new google.maps.Marker(
{
position: new google.maps.LatLng(21.1673643, 72.7851802),
map: map,
title: 'Click me'
});
markers.push(marker);
$.each(locations, function (i, item) {
NewLatLng.push(new google.maps.LatLng(item[0], item[1]));
});
var infowindow = new google.maps.InfoWindow({
content: 'Location info:<br/>Movable Marker !!'
});
google.maps.event.addListener(marker, 'click', function ()
{
infowindow.open(map, marker);
setTimeout(function(){infowindow.close();}, '5000');
});
$.each(NewLatLng, function (i, item) {
setTimeout(function(){
marker.setPosition(item);
markers.push(marker);
NewLatLng1.push(item);
var flightPath = new google.maps.Polyline({
path: NewLatLng1,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
flightPath.setMap(map);
}, i*3000);
});
}
window.onload =initialize;