闪烁加载R Shiny中的文本 [英] Blinking Loading Text in R Shiny
本文介绍了闪烁加载R Shiny中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要如何添加到Shiny的ui部分,使我的#loadmessage闪烁?我看过这样的东西
What do I add to the ui part of shiny that will make my #loadmessage blink? I've seen things like this
但是,我不确定如何在R中实现此功能.
However, I'm not sure how to implement this in R.
我的ui代码具有以下加载功能:
I have the following loading feature in my 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"))
推荐答案
可能是这样吗?
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)
这篇关于闪烁加载R Shiny中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文