i'm working on adding functionality hide/reveal sections of app. code below want in terms of hiding/revealing portions of page, however, verbatimtextoutput doesn't display when inside div(class = "target")
element.
ui <- basicpage( # adds css links work correctly tags$head( tags$style(html(" .target > div { display:none; } .target > div:target{ display:block; }")) ), # adds links a("page 1",href = "#p1"), a("page 2", href = "#p2"), # pages links verbatimtextoutput("works") div(class = "target", div(id = "p1", verbatimtextoutput("doesnt") ), div(id = "p2", "other page") ) ) server <- function(input, output){ output$works <- renderprint("yay!") output$doesnt <- renderprint("hello") } shinyapp(ui, server)
i've tried changing display:none;
display:hidden
, doesn't seem @ all.
it has display:none;
property. if change css else (like changing border dotted solid) works fine. see code below:
ui <- basicpage( # adds css links work correctly tags$head( tags$style(html(" .target > div { border-style:dotted; } .target > div:target{ border-style:solid; }")) ), # adds links a("page 1",href = "#p1"), a("page 2", href = "#p2"), # pages links verbatimtextoutput("works"), div(class = "target", div(id = "p1", verbatimtextoutput("doesnt") ), div(id = "p2", "other page") ) ) server <- function(input, output){ output$works <- renderprint("yay!") output$doesnt <- renderprint("hello") } shinyapp(ui, server)
so question how shiny render ui elements inside undisplayed div?
the problem display:none property discussed here: https://groups.google.com/forum/#!topic/shiny-discuss/yxfuggdoium
Comments
Post a Comment