Improve responsive embeds (references #25)

This commit is contained in:
Bernd Bestel
2018-10-03 19:05:00 +02:00
parent 3b10906e78
commit 7ba6fc875b
5 changed files with 29 additions and 13 deletions

View File

@@ -322,3 +322,22 @@ if ($(".custom-file-label").length > 0)
{
$("<style>").html('.custom-file-label::after { content: "' + L("Select file") + '"; }').appendTo("head");
}
ResizeResponsiveEmbeds = function(fillEntireViewport = false)
{
if (!fillEntireViewport)
{
var maxHeight = $("body").height() - $("#mainNav").outerHeight() - 62;
}
else
{
var maxHeight = $("body").height();
}
$(".embed-responsive").attr("height", maxHeight.toString() + "px");
}
$(window).on('resize', function()
{
console.log($("body").hasClass("fullscreen-responsive-embed-active"));
ResizeResponsiveEmbeds($("body").hasClass("fullscreen-responsive-embed-active"));
});

View File

@@ -50,6 +50,7 @@ function DisplayEquipment(id)
$("#selected-equipment-has-no-instruction-manual-hint").addClass("d-none");
$("a[href='#instruction-manual-tab']").tab("show");
ResizeResponsiveEmbeds();
}
else
{
@@ -118,6 +119,8 @@ $("#selectedEquipmentInstructionManualToggleFullscreenButton").on('click', funct
$("#selectedEquipmentInstructionManualCard").toggleClass("fullscreen");
$("#selectedEquipmentInstructionManualCard .card-header").toggleClass("fixed-top");
$("#selectedEquipmentInstructionManualCard .card-body").toggleClass("mt-5");
$("body").toggleClass("fullscreen-responsive-embed-active");
ResizeResponsiveEmbeds(true);
});
$("#selectedEquipmentDescriptionToggleFullscreenButton").on('click', function(e)

View File

@@ -124,5 +124,7 @@ $('#description').summernote({
lang: L('summernote_locale')
});
ResizeResponsiveEmbeds();
$('#name').focus();
Grocy.FrontendHelpers.ValidateForm('equipment-form');