2016-05-26 6 views
3

Was füge ich dem ui Teil von shiny hinzu, das meine #loadmessage blinken lässt? Ich habe Dinge wie dieseBlinkt Text in R Shiny laden

How to make blinking/flashing text with css3?

jedoch gesehen, ich bin nicht sicher, wie diese

I in R. zu implementieren habe folgende Laden-Funktion in meinem ui Code:

tags$head(tags$style(type="text/css", 
         "#loadmessage { 
         position: fixed; 
         top: 50%; 
         left: 50%; 
         ocacity: 0.50; 
         opacity: 0.0; 
         text-align: center; 
         font-weight: bold; 
         font-size: 300%; 
         color: #000000; 
         z-index: 105; 
         }")) 


    conditionalPanel(condition="$('html').hasClass('shiny-busy')",tags$div("Loading...",id="loadmessage")) 

Antwort

3

Wahrscheinlich so?

library(shiny) 

ui <- shinyUI(
    fluidPage(
    tags$head(tags$style(type="text/css", 
     "#loadmessage { 
     position: fixed; 
     top: 50%; 
     left: 50%; 
     ocacity: 0.50; 
     text-align: center; 
     font-weight: bold; 
     font-size: 300%; 
     color: #000000; 
     z-index: 105; 
     animation: blinker 1s linear infinite; 
     }")), 

    conditionalPanel(condition="$('html').hasClass('shiny-busy')", 
     tags$div("Loading...",id="loadmessage"), 
     tags$script(HTML(" 
     (function blink() { 
      $('#loadmessage').fadeOut(500).fadeIn(500, blink); 
     })(); 
     ")) 
    ), 
    actionButton("action", "action") 
) 
) 

server <- function(input, output){ 
    observeEvent(input$action, { 
    Sys.sleep(3) 
    }) 
} 

shinyApp(ui, server) 
+0

SIE SIND DIE BESTEN. VIELEN DANK! – eagermathperson