forked from daattali/advanced-shiny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.R
46 lines (39 loc) · 817 Bytes
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
library(shiny)
library(shinyjs)
appCSS <- "
#loading-content {
position: absolute;
background: #000000;
opacity: 0.9;
z-index: 100;
left: 0;
right: 0;
height: 100%;
text-align: center;
color: #FFFFFF;
}
"
ui <- fluidPage(
useShinyjs(),
inlineCSS(appCSS),
# Loading message
div(
id = "loading-content",
h2("Loading...")
),
# The main app code goes here
hidden(
div(
id = "app-content",
p("This is a simple example of a Shiny app with a loading screen.")
)
)
)
server <- function(input, output) {
# Simulate work being done for 1 second
Sys.sleep(1)
# Hide the loading message when the rest of the server function has executed
hide(id = "loading-content", anim = TRUE, animType = "fade")
show("app-content")
}
shinyApp(ui, server)