shinyjs plus ugly scrollbar, or clean page but shinyjs broken

Hi, I use shiny inside RMarkdown frequently.
The shinyjs package is wonderful for controlling and customizing HTML elements.
https://trials.shinyapps.io/simplebayesdecision-fancy/
&and switch the "horizontal axis" parameter choice; see the numericInputs change.

But it only works if using the shinyApp(ui, server) call.
In that case a frustrating scrollbar appears, making the page harder to use.

If instead you run the server code in a chunk and output the ui,
scrollbar is gone, yippee, but shinyjs fails silently.
simplebayesdecision-fancy-no-shinyjs/

wantShinyJstoWork = FALSE
if(wantShinyJstoWork) {
  shinyApp(ui = ui, server = server)
} else {
  server(input, output)
  ui
}

I use calls like

runjs("document.getElementById('specDefault').style.color = 'blue'")

Curiously, when wantShinyJstoWork = FALSE, nevertheless these calls work in the browser console...
and when wantShinyJstoWork = TRUE, they don't!
So some kind of scoping or namespace issue I guess.

NEVER MIND.... I had forgotten about the args to useShinyjs

useShinyjs(rmd = FALSE, debug = FALSE, html = FALSE)

Using rmd=TRUE solves the problem.
Tab-complete didn't show the the args... well, of course, because shinyjs was not currently loaded in the session!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.