Improve image scaling on display

This commit is contained in:
Tomas Groth 2019-08-21 21:13:27 +02:00
parent cd25766b79
commit 62ca28cf09

View File

@ -426,10 +426,10 @@ var Display = {
var section = document.createElement("section"); var section = document.createElement("section");
section.setAttribute("id", index); section.setAttribute("id", index);
section.setAttribute("data-background", "#000"); section.setAttribute("data-background", "#000");
section.setAttribute("style", "height: 100%; width: 100%;");
var img = document.createElement('img'); var img = document.createElement('img');
img.src = slide["path"]; img.src = slide["path"];
//img.setAttribute("style", "height: 100%; width: 100%;"); img.setAttribute("style", "max-width: 100%; height: auto; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);");
img.setAttribute("style", "max-width: 100%; height: auto; vertical-align: middle");
section.appendChild(img); section.appendChild(img);
slidesDiv.appendChild(section); slidesDiv.appendChild(section);
Display._slides[index.toString()] = index; Display._slides[index.toString()] = index;