Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
¿Cómo establecer un icono diferente para el marcador activo en el mapa del folleto?

Tengo 2 íconos de marcador greenIcon y redIcon, cómo hacerlo para que cuando el marcador esté activo, se aplique redIcon. Tengo varios marcadores en el mapa. Es decir, es necesario que cambie el icono del marcador activo y cuando se selecciona otro marcador, el anterior vuelve a su estado original, es decir, se vuelve a mostrar greenIcon si se selecciona otro marcador.

 // Latitude, longitude, Zoom Level var map = L.map('map__riot').setView([0,0], 1.7); // TileLayer L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}.png', { attribution: '', minZoom: 0, maxZoom: 20, ext: 'png' }).addTo(map); var greenIcon = L.icon({ iconUrl: 'map-pin@2x.png', iconSize: [64, 64], // size of the icon iconAnchor: [32, 64], popupAnchor: [0, -25] }); var redIcon = L.icon({ iconUrl: 'map-pin-dark@2x.png', iconSize: [64, 64], // size of the icon iconAnchor: [32, 64], popupAnchor: [0, -25] }); for (const site of sites) { marker = new L.marker([site.lat, site.lng],{icon: greenIcon}) .on('click', function (e) { document.getElementById('titler').textContent = site.address }) .addTo(map); }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!