Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps API v3 drop markers from XML with delay?
    primarykey
    data
    text
    <p>I'm working on displaying several batches of markers using the Google Maps api (v3) and jQuery.</p> <p>I've got it working almost exactly as I want it but I would need to drop the markers one by one instead of all at once.</p> <p>I've found <a href="http://code.google.com/intl/el-GR/apis/maps/documentation/javascript/examples/marker-animations-iteration.html" rel="nofollow">this example</a> on the Google maps documentation but I can't work out how to integrate it with my script.</p> <p>Would someone please be able help me?</p> <p>Here's my code so far:</p> <pre><code>$(document).ready(function () { $("#map").css({ height: 600, width: 958 }); var jeLatLng = new google.maps.LatLng(17.74033553, 83.25067267); jeMap.init('#map', jeLatLng, 11); $("#showmarkers").click(function (e) { jeMap.placeMarkers('markers.xml'); }); $("#showmarkers2").click(function (e) { jeMap.placeMarkers('markers2.xml'); }); }); var jeMap = { map: null } var UK = new google.maps.LatLng(21.192481, 0.0); jeMap.init = function (selector, latLng, zoom) { var myOptions = { zoom: 2, center: UK, mapTypeId: google.maps.MapTypeId.HYBRID, streetViewControl: false, mapTypeControl: false, backgroundColor: '#111' } this.map = new google.maps.Map($(selector)[0], myOptions); } var infoWindow = new google.maps.InfoWindow(); jeMap.placeMarkers = function (filename) { $.get(filename, function (xml) { $(xml).find("marker").each(function () { var name = $(this).find('name').text(); var address = $(this).find('address').text(); // create a new LatLng point for the marker var lat = $(this).find('lat').text(); var lng = $(this).find('lng').text(); var point = new google.maps.LatLng(parseFloat(lat), parseFloat(lng)); var marker = new google.maps.Marker({ map: jeMap.map, position: point, animation: google.maps.Animation.DROP, icon: 'marker_pink.png' }); var html = '&lt;strong&gt;' + name + '&lt;/strong.&gt;&lt;br /&gt;' + address; google.maps.event.addListener(marker, 'click', function () { infoWindow.setContent(html); infoWindow.open(jeMap.map, marker); }); }); }); } </code></pre> <p>I understand I need to somehow modify the jeMap.placeMarkers function so it loops through each marker with a delay between each cycle, just can't figure out how.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload