2016-05-09 32 views
1

我正在試圖在dashboardSidebar中建立一個閃亮的儀表板,頁腳粘在視口的底部。對於這一點,我想使用自定義的CSS樣式的建議here(一個許多搜索結果谷歌搜索「頁腳底部引導」時):閃亮的儀表板:在儀表板中的粘滯頁腳Sidebar

# create an example for the SO question on sticky footer 
library(shiny) 
library(shinydashboard) 

# sidebar 
so_sidebar = dashboardSidebar(
    sidebarMenu(
    menuItem(
     text = "Some text." 
    ) 
), 
    # footer here 
    tags$footer(
    tags$p("Footer message here."), 
    style = " 
     * { 
    margin: 0; 
    } 
    html, body { 
    height: 100%; 
    } 
    .wrapper { 
    min-height: 100%; 
    height: auto !important; /* This line and the next line are not necessary unless you need IE6 support */ 
    height: 100%; 
    margin: 0 auto -155px; /* the bottom margin is the negative value of the footer's height */ 
    } 
    .footer, .push { 
    height: 155px; /* .push must be the same height as .footer */ 
    } 

    /* 

    Sticky Footer by Ryan Fait 
    http://ryanfait.com/ 

    */" 
) 

) 

# compose the dashboard 
so_ui = dashboardPage(
    header = dashboardHeader(
    title = "SO question" 
), 
    sidebar = so_sidebar, 
    body = dashboardBody() 
) 

# run the application 
shiny::shinyApp(
    ui = so_ui, 
    server = shinyServer(function(input, output) {}) 
) 

因爲我從來沒有與自定義的CSS工作之前,我不知道我正在使用CSS權利。我正在按照說明here

有人可以幫助獲得這個CSS正確的,或任何其他建議粘着在Shiny Dashboard邊欄的可視區域底部的頁腳?

回答

2

嘗試this

<div> 
    Sticky Footer 
</div> 

div{ 
    position:fixed; 
    bottom:0; 
    right:0; 
    left:0; 
    background:#00adfc; 
    padding:10px; 
    box-sizing:border-box; 
} 

位置始終固定停留在指定位置,並給出了發粘的感覺。

+0

謝謝你。但是,這不是Shiny特有的,我不知道如何實現這一點。 Shiny是一個通過編寫R代碼來生成HTML代碼的R框架。 – tchakravarty

+0

其實,我得到了這個與Shiny一起工作 - 我將更新問題中的閃亮代碼並標記此權利。我還有另一個問題。我怎樣才能在這個文本的上方得到一個也固定在視口底部的圖像? – tchakravarty