Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bearloga
Created January 24, 2017 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bearloga/7d6882730cf6defa533af21360c4cdc0 to your computer and use it in GitHub Desktop.
Save bearloga/7d6882730cf6defa533af21360c4cdc0 to your computer and use it in GitHub Desktop.
A Shiny app with the header (title) panel fixed in place at the top as the user scrolls down.
header <- headerPanel("Hello Shiny!")
header[[2]]$attribs$id = "header"
ui <- fluidPage(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "custom.css")
),
header,
sidebarLayout(
sidebarPanel(sliderInput("obs", "Number of observations:", min = 0, max = 1000, value = 500)),
mainPanel(plotOutput("distPlot", height = "2000px"))
)
)
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs))
})
}
shinyApp(ui, server)
/* NOTE: put this file in a subdirectory named "www" */
#header {
position: fixed;
z-index: 100000;
}
/* TODO: push content down */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment