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

151
Visualizações
replicate Shiny leaflet easybutton 'locate you' but with an custom html button

Trying to replicate the action of an Leaflet easybutton (as show on the leaflet for R Github additional features), where the user clicks the easybutton and it zooms to their location.

Id like to replicate this but with a custom html button and JS in the tags$script.

No luck so far, efforts so far:

library(shiny)
library(leaflet)


ui <- fluidPage(
  leafletOutput("mymap"),
  absolutePanel(id = "button_1", top = "2%", right = "2%", fixed = TRUE,
                HTML('<p> <button class="btn btn-large btn-primary" type="button" id="button1"><i class="icon-star"></i>Large button</button></p>'),
                singleton(tags$script(HTML('$("button1").on("click", function(btn, map){ map.locate({setView: true}));')))
  )
)

server <- function(input, output, session) {
  
  output$mymap <- renderLeaflet({
    leaflet() %>%
      addProviderTiles(providers$Stamen.TonerLite
      )
  })
  
    }
shinyApp(ui, server)
about 4 years ago · Juan Pablo Isaza
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