Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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=[

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'
        $.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 ()
  , marker);
            setTimeout(function(){infowindow.close();}, '5000');
        $.each(NewLatLng, function (i, item) {


 var flightPath = new google.maps.Polyline({
          path: NewLatLng1,
          strokeColor: '#FF0000',
          strokeOpacity: 1.0,
          strokeWeight: 2
            }, i*3000);

    window.onload =initialize;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900