Add a Settlement in Progress indicator for a brilliant app

I use brilliant to create a web application. Some steps will take some time to complete, so I want to add a calculation to the process indicator in a brilliant application.

I found Shiny is busy (or loading) when changing tabs in stackoverflow, but min and max must be specified in shinyIncubator packages.

Then I found this blog: http://withr.me/blog/2014/01/03/add-calculation-in-process-indictor-for-shiny-application/ It provided a great way to do this.

 shinyUI(bootstrapPage( # Add custom CSS & Javascript; tagList( tags$head( tags$link(rel="stylesheet", type="text/css",href="style.css"), tags$script(type="text/javascript", src = "busy.js") ) ), div(class = "busy", p("Calculation in progress.."), img(src="http://imageshack.us/a/img827/4092/ajaxloaderq.gif") ), div(class = "span4", uiOutput("obs")), div(class = "span8", plotOutput("distPlot")) )) 

Java script;

 setInterval(function(){ if ($('html').attr('class')=='shiny-busy') { setTimeout(function() { if ($('html').attr('class')=='shiny-busy') { $('div.busy').show() } }, 1000) } else { $('div.busy').hide() } }, 100) 

style.css

 div.busy { position:absolute; top: 40%; left: 50%; margin-top: -100px; margin-left: -50px; display:none; background: rgba(230, 230, 230, .8); text-align: center; padding-top: 20px; padding-left: 30px; padding-bottom: 40px; padding-right: 30px; border-radius: 5px; } 

So my question is how to add custom CSS and Javascript to my ui file? I tried to create two separate js and css files, but the indicator is constantly displayed on the left. Then I tried to put these two code snippets directly in R, although definitely a syntax error. Thanks!

The problem is solved: create a folder with the name "www" and place two files in it.

+6
source share
1 answer

Create a folder named "www" and put these two files in it.

0
source

All Articles