rstudio / flexdashboard

Easy interactive dashboards for R
https://pkgs.rstudio.com/flexdashboard/
Other
816 stars 300 forks source link

JS user defined function in navbar link #208

Closed Patanouque closed 5 years ago

Patanouque commented 5 years ago

Hello, I'm trying to build a flexdashboard document with a help link in the navbar that triggers a modal. For the modal I'm using the package bsplus and it works great if I put a button in the dashboard. I would like to trigger the opening of the modal with an icon in the navbar, for exemple with a onclick argument but it is not handled by flex_dashboard

repro_ex_modal_rmd

For that I try to use an javascript function that would be

$( "#navbar a" ).click(function() { $("#modal_markdown").modal(); });

It works great if I run it in the javascript console in google chrome developper tool, after the dashboard is loaded but I can't make it work using <script> or tags$script inside the dashboard body

Here is what I tried: