Adding multiple markers to Google Map

前端 未结 2 1756
梦如初夏
梦如初夏 2021-02-08 15:47

I\'m looking to add markers for each business listed to a Google map v3 API on this page in the top right hand corner.

I\'m not sure how to do this for multiple postcod

2条回答
  •  生来不讨喜
    2021-02-08 15:48

    I see my code in this!

    I am assuming that you want markers to be added on the map. This can be easily done by tweaking the code I supplied before. Quite simply:

         geolocate("Your postcode here", function(c) {
             var marker = new google.maps.Marker({
                position: new google.maps.LatLng(c.center.lat, c.center.lng),
                map: map,
                // Your other google maps marker options here
             });
         });
    

    Just duplicate this code as many times as necessary by printing it using ASP, making sure that map and geolocate are both within the scope. Each time, it will simply add your marker!

提交回复
热议问题