Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

259
Visualizações
How can I update the pins on a google map using fetch each time a slide changes?

I have a Google map set up in a Slider Revolution slider and it pulls locations from a database. I have it set up so that it updates every 10 seconds, which works, but it seems that any time it runs and the map slide is not active, the pins disappear until the next time it updates. I would like it to update after each slide change.

This is the code that works for updating every 10 seconds:

function fetch(){
  var mapsvg = this;
  setInterval(()=>{ 
  mapsvg.database.find() 
  }, 133000);
}
fetch();

This is the code that I tried to use for updating after slide change:

revapi2.bind("revolution.slide.onafterswap",function fetch(){
     var mapsvg = this;
    mapsvg.database.find();
 
})
fetch();

I get two errors with this code:

Uncaught (in promise) TypeError: Window.fetch: At least 1 argument required, but only 0 passed

and

Uncaught TypeError: mapsvg.database is undefined

Any help would be most appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In the event listener of Slider Revolution, you reference "this" which is the Slider Revolution object itself in that case. That object has no "database" attribute, so it fails.

You don't need to call fetch() in the second part, since the database.find() function will be called on slide swap event anyway.

As best you define global the mapsvg reference and in the Slider Revolution event listener just call mapsvg.database.find();

If you wish, drop a link to the current page, and I can give you an exact description of how to do it.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda