Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Google Maps API v3] ukrywanie markerów
warland
post
Post #1





Grupa: Zarejestrowani
Postów: 50
Pomógł: 0
Dołączył: 22.01.2018

Ostrzeżenie: (10%)
X----


Mam taki kod:

  1. var bounds = new google.maps.LatLngBounds();
  2. var i, center;
  3.  
  4. for (i = 0; i < shape.length; i++) {
  5. bounds.extend(shape[i]);
  6.  
  7. }
  8. center = bounds.getCenter();
  9. var image = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag2.png';
  10. var marker = new google.maps.Marker({
  11. position: { lat: center.lat() + land_size, lng: center.lng() },
  12. map: map,
  13. zIndex: 10,
  14. icon: image
  15. });
  16. google.maps.event.addListener(map, 'zoom_changed', function() {
  17. zoom = map.getZoom();
  18.  
  19. if (zoom < 7) {
  20. marker.setVisible(false);
  21. } else {
  22. marker.setVisible(true);
  23. }
  24. });
  25. marker.setVisible(false);



Problem polega na tym że w chwili odkrycia markerów ładuje się tylko jeden (mimo że np. jest ich 5)
Nie wiem jak ten problem rozwiązać.
Bez ukrywania markerów wszystko działa jak należy i pojawiają się wszystkie.

Czy jest ktoś kto może mi pomóc?

Ten post edytował warland 6.02.2018, 12:34:48
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 15:37