From 2e6b202a5ee213a86addefbae1bdc6b927b83064 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Wed, 3 Apr 2024 11:20:10 -0400 Subject: [PATCH] docs(value-box): Replace ResizeObserver with `bslib.card` event listener (#1037) --- vignettes/value-boxes/index.Rmd | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vignettes/value-boxes/index.Rmd b/vignettes/value-boxes/index.Rmd index 44167d83c..ff3936c68 100644 --- a/vignettes/value-boxes/index.Rmd +++ b/vignettes/value-boxes/index.Rmd @@ -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}); + }) }" )