Fix: Broken design on resize

pull/16/head
Juraj Nyíri 4 years ago
parent 004c20d309
commit 53cbc3c9d6

@ -61,9 +61,10 @@ class ContentCardExample extends HTMLElement {
if (_this.previousPositions.length === 0) { if (_this.previousPositions.length === 0) {
for (let i = 0; i < _this.movieElems.length; i++) { for (let i = 0; i < _this.movieElems.length; i++) {
_this.previousPositions[i] = {}; _this.previousPositions[i] = {};
_this.previousPositions[i]["top"] = _this.movieElems[i].offsetTop; _this.previousPositions[i]["top"] =
_this.movieElems[i].parentElement.offsetTop;
_this.previousPositions[i]["left"] = _this.previousPositions[i]["left"] =
_this.movieElems[i].offsetLeft; _this.movieElems[i].parentElement.offsetLeft;
} }
} }
for (let i = 0; i < _this.movieElems.length; i++) { for (let i = 0; i < _this.movieElems.length; i++) {
@ -71,9 +72,9 @@ class ContentCardExample extends HTMLElement {
_this.previousPositions[i] && _this.previousPositions[i] &&
_this.movieElems[i].dataset.clicked !== "true" && _this.movieElems[i].dataset.clicked !== "true" &&
(_this.previousPositions[i]["top"] !== (_this.previousPositions[i]["top"] !==
_this.movieElems[i].offsetTop || _this.movieElems[i].parentElement.offsetTop ||
_this.previousPositions[i]["left"] !== _this.previousPositions[i]["left"] !==
_this.movieElems[i].offsetLeft) _this.movieElems[i].parentElement.offsetLeft)
) { ) {
_this.renderPage(hass); _this.renderPage(hass);
_this.previousPositions = []; _this.previousPositions = [];

Loading…
Cancel
Save