Closed stla closed 2 years ago
Hi @stla.
The proposed addition to jsCalls
seems really great, I'd be really happy to add it to the package.
I'll take a look at the "hide issue" as soon as I can, and then we'll think about a proper PR together.
Hello,
I've found a way to initially hide. I enclose everything in a div with all children hidden, and on showing the ui, I remove the css which hides the children.
animatedConditionalPanel <- function(
ui, condition,
show,
hide = animateCSS("fadeOut", duration = 0), # default: no hide effect
fadeIn = 0, fadeOut = 0
){
randomID <- paste0(
sample(c(letters,LETTERS), 20L, replace = TRUE),
collapse = ""
)
conditionalJS(
ui = tags$div(
id = randomID,
ui,
tags$style(HTML(sprintf("#%s>* {visibility: hidden;}", randomID)))
),
condition = condition,
jsCalls$custom(
true = paste0(
sprintf("$('#%s>*').css('visibility', 'visible'); ", randomID),
animatedShow(
show,
fadeDuration = fadeIn
)),
false = animatedHide(
hide,
fadeDuration = fadeOut
)
)
)
}
The feature was added in version 0.2.2 in #13
Hello,
Thank you for this package.
I did that a long time ago, but I have updated my code with
conditionalJS
, this is more convenient:I wanted to propose you a PR but there's a problem: the hide effect is initially shown; how to initially hide the panel completely?
If you are not interested in a PR, perhaps I'll do a package. Cheers.