Skip to content
Euwww, shticky shtuff
R JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst/sticky-kit
man
.Rbuildignore
.gitignore
DESCRIPTION
LICENSE SHTICK Apr 18, 2019
LICENSE.md SHTICK Apr 18, 2019
NAMESPACE
NEWS.md
README.md minut4e change in readme Jan 30, 2020

README.md

shticky

Make 'Shiny' element shticky.

Installation

# install.packages("remotes")
remotes::install_github("JohnCoene/shticky")

How-to

  1. Initialise shticky shtuff with the new method.
  2. Make the element shticky with shticky.
  3. Unshtick the element with the unshtick method.

Note that the new method takes an id.

Example

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)
You can’t perform that action at this time.