Skip to content

Instantly share code, notes, and snippets.

@sckott
Last active April 15, 2018 07:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sckott/5694313 to your computer and use it in GitHub Desktop.
Save sckott/5694313 to your computer and use it in GitHub Desktop.
Shiny - how to make footer stick to bottom of page

run by doing

library(shiny)
runGist('5694313')
library(shiny)
## Set up server output
shinyServer(function(input, output) {
foo <- reactive({
input$num
})
output$plot <- renderPlot({
number <- foo()
plot(rnorm(number))
})
output$plot2 <- renderPlot({
number <- foo()
plot(rnorm(number))
})
})
library(shiny)
shinyUI(pageWithSidebar(
headerPanel(title=HTML("TaxaViewer - <i>Explore data on your species list</i> "), windowTitle="TaxaViewer"),
sidebarPanel(
wellPanel(
h4(strong("Do something")),
textInput(inputId="num", label="Number", value=I(10^5))
)
),
mainPanel(
tags$style(type = 'text/css',
"footer{position: absolute; bottom:5%; left: 33%; padding:5px;}"
),
tabsetPanel(
tabPanel("output",
plotOutput("plot"),
HTML('<footer>
<img src="http://amor.cms.hu-berlin.de/~huangrui/images/softwares/Rlogo.png", height="120", width="120"</img>
</footer>')
),
tabPanel("output",
plotOutput("plot2"),
HTML('<footer>
<img src="http://jasontheodor.com/wp-content/uploads//2012/02/things.jpg", height="120", width="120"</img>
</footer>')
)
))
))
@prakashmyth
Copy link

prakashmyth commented Oct 11, 2016

Add these lines inside the dashboard body

tags$footer(title="Your footer here", align = "right", style = "
position:absolute;
bottom:0;
width:100%;
height:50px; /* Height of the footer */
color: white;
padding: 10px;
background-color: black;
z-index: 1000;"
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment