grocy/js/helpers/embeds.js
2021-06-18 19:32:57 +02:00

21 lines
495 B
JavaScript

function ResizeResponsiveEmbeds(fillEntireViewport = false)
{
var maxHeight = null;
if (!fillEntireViewport)
{
maxHeight = $("body").height() - $("#mainNav").outerHeight() - 62;
}
else
{
maxHeight = $("body").height();
}
$("embed.embed-responsive").attr("height", maxHeight.toString() + "px");
$("iframe.embed-responsive").each(function()
{
$(this).attr("height", $(this)[0].contentWindow.document.body.scrollHeight.toString() + "px");
});
}
export { ResizeResponsiveEmbeds }