Skip to content

Instantly share code, notes, and snippets.

@kcarnold
Created September 16, 2023 14:52
Show Gist options
  • Save kcarnold/551feebb4f7bd54e0e530174e75a04da to your computer and use it in GitHub Desktop.
Save kcarnold/551feebb4f7bd54e0e530174e75a04da to your computer and use it in GitHub Desktop.
Quarto plugin to hotfix Plotly plot sizing
window.FixPlotlySize = {
id: 'FixPlotlySize',
init: function(Reveal) {
Reveal.addEventListener( 'slidechanged', function( event ) {
let curSlide = Reveal.getCurrentSlide();
require(['plotly'], function(Plotly) {
let plotlyDivs = curSlide.querySelectorAll('.js-plotly-plot');
for (let i = 0; i < plotlyDivs.length; i++) {
Plotly.Plots.resize(plotlyDivs[i]);
}
});
});
}
}
name: FixPlotlySize
script: ["fix-plotly-size.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment