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

143
Views
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
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!