From 53cbc3c9d61d041c66741bbc57d1eedf740fb647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Mon, 3 May 2021 01:46:50 +0200 Subject: [PATCH] Fix: Broken design on resize --- www/content-card-example.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/www/content-card-example.js b/www/content-card-example.js index db877ca..19ef676 100644 --- a/www/content-card-example.js +++ b/www/content-card-example.js @@ -61,9 +61,10 @@ class ContentCardExample extends HTMLElement { if (_this.previousPositions.length === 0) { for (let i = 0; i < _this.movieElems.length; 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.movieElems[i].offsetLeft; + _this.movieElems[i].parentElement.offsetLeft; } } for (let i = 0; i < _this.movieElems.length; i++) { @@ -71,9 +72,9 @@ class ContentCardExample extends HTMLElement { _this.previousPositions[i] && _this.movieElems[i].dataset.clicked !== "true" && (_this.previousPositions[i]["top"] !== - _this.movieElems[i].offsetTop || + _this.movieElems[i].parentElement.offsetTop || _this.previousPositions[i]["left"] !== - _this.movieElems[i].offsetLeft) + _this.movieElems[i].parentElement.offsetLeft) ) { _this.renderPage(hass); _this.previousPositions = [];