
Make 'Shiny' element shticky.
# install.packages("remotes")
remotes::install_github("JohnCoene/shticky")
new method.shticky.unshtick method.Note that the new method takes an id.
library(shiny)
library(shticky)
longdiv <- function(...){
div(style = "min-height:100vh;", ...)
}
ui <- fluidPage(
use_shticky(),
h1(id = "stick", "SHTICKY"),
longdiv(),
longdiv(),
actionButton("unstick", "UNSHTICK"),
longdiv(),
)
server <- function(input, output, session) {
shtick <- Shtick$
new("stick")$
shtick(top = 200)
observeEvent(input$unstick, {
shtick$unshtick()
})
}
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.