Created
January 24, 2017 02:07
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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