Fix: Design on phones or slower devices

pull/16/head
Juraj Nyíri 4 years ago
parent 1669fa80be
commit 284b93fa30

@ -54,14 +54,19 @@ class ContentCardExample extends HTMLElement {
//todo: run also on resize //todo: run also on resize
calculatePositions = () => { calculatePositions = () => {
const _this = this; const _this = this;
//todo: figure out why timeout is needed here and do it properly //todo: figure out why loop is needed here and do it properly
setTimeout(function () { const setLeftOffsetsInterval = setInterval(() => {
_this.movieElems = _this.getElementsByClassName("movieElem"); _this.movieElems = _this.getElementsByClassName("movieElem");
for (let i = 0; i < _this.movieElems.length; i++) { for (let i = 0; i < _this.movieElems.length; i++) {
if (_this.movieElems[i].offsetLeft === 0) {
break;
} else {
clearInterval(setLeftOffsetsInterval);
}
_this.movieElems[i].style.left = _this.movieElems[i].offsetLeft + "px"; _this.movieElems[i].style.left = _this.movieElems[i].offsetLeft + "px";
_this.movieElems[i].dataset.left = _this.movieElems[i].offsetLeft; _this.movieElems[i].dataset.left = _this.movieElems[i].offsetLeft;
} }
}, 1); }, 10);
}; };
minimizeAll = () => { minimizeAll = () => {

Loading…
Cancel
Save