Jump to content

Addming multiple markers on google map


toolman

Recommended Posts

Hi there,

I have a map in which displays a marker.

How can I add multiple markers to the map?

This is my code:

var doncaster = new google.maps.LatLng(53.47921, -1.00201);
var parliament = new google.maps.LatLng(53.47921, -1.00201);
var marker;
var map;

function initialize() {
  var mapOptions = {
    zoom: 14,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    center: doncaster
  };

  map = new google.maps.Map(document.getElementById('map-canvas'),
          mapOptions);

  marker = new google.maps.Marker({
    map:map,
    draggable:true,
    animation: google.maps.Animation.DROP,
    position: parliament
  });
  google.maps.event.addListener(marker, 'click', toggleBounce);
}

function toggleBounce() {

  if (marker.getAnimation() != null) {
    marker.setAnimation(null);
  } else {
    marker.setAnimation(google.maps.Animation.BOUNCE);
  }
}

google.maps.event.addDomListener(window, 'load', initialize);



Thanks

Link to comment
https://forums.phpfreaks.com/topic/283720-addming-multiple-markers-on-google-map/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.