Skip to content

Commit

Permalink
docs(value-box): Replace ResizeObserver with bslib.card event liste…
Browse files Browse the repository at this point in the history
…ner (#1037)
  • Loading branch information
gadenbuie authored Apr 3, 2024
1 parent c9c17f8 commit 2e6b202
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions vignettes/value-boxes/index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,10 @@ sparkline <- plot_ly(economics) %>%
config(displayModeBar = F) %>%
htmlwidgets::onRender(
"function(el) {
var ro = new ResizeObserver(function() {
var visible = el.offsetHeight > 200;
Plotly.relayout(el, {'xaxis.visible': visible});
});
ro.observe(el);
el.closest('.bslib-value-box')
.addEventListener('bslib.card', function(ev) {
Plotly.relayout(el, {'xaxis.visible': ev.detail.fullScreen});
})
}"
)
Expand Down

0 comments on commit 2e6b202

Please sign in to comment.