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

225
Views
¿Cómo configurar el marcador de la ventana de información de enfoque de Google Maps?

Quiero mostrar una ubicación en Google Maps cuyos datos se obtienen de una base de datos. Hasta ahora, he sido capaz de hacerlo. Sin embargo, todavía hay un problema al mostrar la ventana de información como se muestra a continuación.

ingrese la descripción de la imagen aquí

Cuando hago clic en uno de los marcadores, puede abrir una ventana de información con datos de ese marcador.

ingrese la descripción de la imagen aquí

Y cuando hago clic en otro marcador, también muestra datos de ese marcador. Pero la ventana de información aún se enfoca en el mismo marcador.

¿Como arreglarlo? el siguiente código que he hecho.

 <script> function initMap() { const map = new google.maps.Map(document.getElementById("map"), { zoom: 10, center: { lat: -6.261493, lng: 106.810600 }, }); setMarkers(map); } const locations = @php print_r(json_encode($markers)) @endphp; function setMarkers(map) { for (let i = 0; i < locations.length; i++) { const location = locations[i]; let html = ""; html += `<div id="content-${location[0]}">`; html += `<div id="siteNotice">`; html += `</div>`; html += `<h1 id="firstHeading" class="firstHeading">${location[1]}</h1>`; html += `<div id="bodyContent">`; html += `<p>${location[2]}</p>`; html += `<a href="reports/show/${location[0]}" class="btn btn-dark btn-sm">Detail</a>`; html += `</div>`; html += `</div>`; const infowindow = new google.maps.InfoWindow({ content: html, }); marker = new google.maps.Marker({ position: { lat: parseFloat(location[4]), lng: parseFloat(location[5]) }, map, title: location[3] }); marker.addListener("click", () => { infowindow.open({ anchor: marker, map, shouldFocus: true, }); }); console.log(location); } } </script>
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!