The Google Maps V3 API does not allow you to add "Listing" when placing markers after searching for places

I start the search with google.maps.places.PlacesService(map), and then put the markers on the map, which is fine. I do this every time a dragend event occurs.

But then, each time, it is added on the right side of the "Listing on yellowpages" card. Therefore, if I scroll 3 times, I get 3 "List by yellowpages". How to remove this?

+3
source share
2 answers

I had a similar problem using the Google Maps API. It turns out that this was due to the fact that every time I created a new PlacesService object, and when I switched to the only PlacesService object, this problem disappeared.

, PlacesService .

+5

-

lib jquery

service = new google.maps.places.PlacesService(map);
service.textSearch(request, function(request, status){
    if(status==google.maps.places.PlacesServiceStatus.OK){
        $('.listing-by-map').hide();
        $('#map div').last().addClass('listing-by-map');
        //...
    }
});
+2

All Articles