I have a navbarPage
, within that I have three navbarMenu
. But the first navbarMenu
i.e, "Help" is always highlighted by default and with that navbarMenu
tabpanel
"Manual" is also always highlighted. How to avoid that. The sample code is shown below
ui.r
shinyUI(fluidPage(theme = "bootstrap.css", (navbarPage("B Version", position = c("fixed-top"), fluid=TRUE, navbarMenu("Help", tabPanel( a("Manual", target="_blank", href="Manual.pdf") ), tabPanel( a("Supporte", target="_blank", href="gpl.pdf") ), tabPanel( a("Tutorials", downloadLink("AbE", "Expression", class=" fa fa-cloud-download"), downloadLink("DiEx", "Expression", class=" fa fa-cloud-download") ) ) ), navbarMenu("Sample Data", tabPanel( downloadLink("AData", " Aff", class=" fa fa-cloud-download") ), tabPanel( downloadLink("CData", " Code", class=" fa fa-cloud-download") ), tabPanel( downloadLink("IData", " Il", class=" fa fa-cloud-download") ) ), navbarMenu("Stand-Alone Version", tabPanel( downloadLink("CodeandData", " app", class=" fa fa-cloud-download") ), tabPanel( a("Stand-alone Manual", target = "_blank", href= "Stand-alone.pdf") ) ) ) ) ) )
server.r
shinyServer(function(input, output,session) { })
-------------------------------------------------------------------
*Edit
This part show how it reacts with the answer provided @amrrs . It shows the data when the cursor is pressed and then again disappears.
ui.r
shinyUI(fluidPage(theme = "bootstrap.css", tags$script("setInterval(function(){ $('.active').removeClass('active');//remove class active },1000);"), (navbarPage("B Version", position = c("fixed-top"), fluid=TRUE,selected = "none", navbarMenu("Help", tabPanel( a("Manual", target="_blank", href="Manual.pdf") ), tabPanel( a("Supporte", target="_blank", href="gpl.pdf") ), tabPanel( a("Tutorials", downloadLink("AbE", "Expression", class=" fa fa-cloud-download"), downloadLink("DiEx", "Expression", class=" fa fa-cloud-download") ) ) ), navbarMenu("Sample Data", tabPanel( downloadLink("AData", " Aff", class=" fa fa-cloud-download") ), tabPanel( downloadLink("CData", " Code", class=" fa fa-cloud-download") ), tabPanel( downloadLink("IData", " Il", class=" fa fa-cloud-download") ) ), navbarMenu("Stand-Alone Version", tabPanel( downloadLink("CodeandData", " app", class=" fa fa-cloud-download") ), tabPanel( a("Stand-alone Manual", target = "_blank", href= "Stand-alone.pdf") ) ) ) ), br(), br(), sidebarLayout( sidebarPanel( h5("Upload Data Files",style="bold"), fileInput("files", "Choose CSV/txt processed files or raw files", multiple = "TRUE", accept=c('text/csv', 'text/comma-separated-values, text/plain', '.csv','.cel','.TXT','.txt')) ), mainPanel( tabsetPanel(id = "MaTabs", tabPanel("Source-data", dataTableOutput("sourced")) ) ) )))
server.r
shinyServer(function(input, output,session) { output$sourced <- renderDataTable(mtcars) })
2 Answers
Answers 1
Based on this answer adding a small snippet of js helps it.
Updated Code with hiding active only for nav:
shinyUI(fluidPage(theme = "bootstrap.css", tags$script("setInterval(function(){ $('.nav').removeClass('active');//remove class active },1000);"), (navbarPage("B Version", position = c("fixed-top"), fluid=TRUE,selected = "none", navbarMenu("Help", tabPanel( a("Manual", target="_blank", href="Manual.pdf") ), tabPanel( a("Supporte", target="_blank", href="gpl.pdf") ), tabPanel( a("Tutorials", downloadLink("AbE", "Expression", class=" fa fa-cloud-download"), downloadLink("DiEx", "Expression", class=" fa fa-cloud-download") ) ) ), navbarMenu("Sample Data", tabPanel( downloadLink("AData", " Aff", class=" fa fa-cloud-download") ), tabPanel( downloadLink("CData", " Code", class=" fa fa-cloud-download") ), tabPanel( downloadLink("IData", " Il", class=" fa fa-cloud-download") ) ), navbarMenu("Stand-Alone Version", tabPanel( downloadLink("CodeandData", " app", class=" fa fa-cloud-download") ), tabPanel( a("Stand-alone Manual", target = "_blank", href= "Stand-alone.pdf") ) ) ) ), br(), br(), sidebarLayout( sidebarPanel( h5("Upload Data Files",style="bold"), fileInput("files", "Choose CSV/txt processed files or raw files", multiple = "TRUE", accept=c('text/csv', 'text/comma-separated-values, text/plain', '.csv','.cel','.TXT','.txt')) ), mainPanel( tabsetPanel(id = "MaTabs", tabPanel("Source-data", dataTableOutput("sourced")) ) ) )))
Answers 2
To remove highlight from first navbarMenu
you can add an argument selected = "none"
in navbarPage
function. To remove highlight from navbarMenu tabpanel
you can use the following css:
tags$style(type = 'text/css', ".navbar-default .navbar-nav .open .dropdown-menu .active a{color : #333; background-color:#f5f5f5;}")
So in your code it would be something like this:
shinyUI(fluidPage(theme = "bootstrap.css", tags$style(type = 'text/css', ".navbar-default .navbar-nav .open .dropdown-menu .active a{color : #333; background-color:#f5f5f5;}"), (navbarPage("B Version", position = c("fixed-top"), fluid=TRUE,selected = "none", navbarMenu("Help", tabPanel( a("Manual", target="_blank", href="Manual.pdf") ), tabPanel( a("Supporte", target="_blank", href="gpl.pdf") ), tabPanel( a("Tutorials", downloadLink("AbE", "Expression", class=" fa fa-cloud-download"), downloadLink("DiEx", "Expression", class=" fa fa-cloud-download") ) ) ), navbarMenu("Sample Data", tabPanel( downloadLink("AData", " Aff", class=" fa fa-cloud-download") ), tabPanel( downloadLink("CData", " Code", class=" fa fa-cloud-download") ), tabPanel( downloadLink("IData", " Il", class=" fa fa-cloud-download") ) ), navbarMenu("Stand-Alone Version", tabPanel( downloadLink("CodeandData", " app", class=" fa fa-cloud-download") ), tabPanel( a("Stand-alone Manual", target = "_blank", href= "Stand-alone.pdf") ) ) ) ) ) )
With this you get the output as:
and
sb game hacker
ReplyDelete