mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 19:37:12 +00:00
Added a workaround for sporadically (not fully reproducible) empty modal iframes in Chrome based Browsers (references #2480 and #2421)
This commit is contained in:
@@ -554,9 +554,27 @@ ResizeResponsiveEmbeds = function(fillEntireViewport = false)
|
||||
}
|
||||
$("embed.embed-responsive").attr("height", maxHeight.toString() + "px");
|
||||
|
||||
ResizeIframes();
|
||||
}
|
||||
ResizeIframes = function()
|
||||
{
|
||||
$("iframe.embed-responsive").each(function()
|
||||
{
|
||||
$(this).attr("height", $(this)[0].contentWindow.document.body.scrollHeight.toString() + "px");
|
||||
var desiredHeight = $(this)[0].contentWindow.document.body.scrollHeight;
|
||||
if (desiredHeight == 0)
|
||||
{
|
||||
// The corresponding frame should be loaded after the "onload" event fired,
|
||||
// this seems to be sometimes (not really reproducible) not the case in Chrome based Browsers...
|
||||
// => So if that happens, just try this again later
|
||||
setTimeout(function()
|
||||
{
|
||||
ResizeIframes();
|
||||
}, 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).attr("height", desiredHeight.toString() + "px");
|
||||
}
|
||||
});
|
||||
}
|
||||
$(window).on('resize', function()
|
||||
|
Reference in New Issue
Block a user