Fix: Details view position when scrolling

pull/16/head
Juraj Nyíri 4 years ago
parent 050a742501
commit 28aa21697a

@ -281,15 +281,27 @@ class ContentCardExample extends HTMLElement {
}; };
hideDetails = () => { hideDetails = () => {
this.detailElem.style.top = "0px";
this.detailElem.style.color = "rgba(255,255,255,0)"; this.detailElem.style.color = "rgba(255,255,255,0)";
this.detailElem.style["z-index"] = "0"; this.detailElem.style["z-index"] = "0";
}; };
showDetails = (data) => { showDetails = (data) => {
this.detailElem.children[0].innerHTML = data.title; const _this = this;
this.detailElem.children[1].innerHTML = data.summary; const doc = document.documentElement;
this.detailElem.style.color = "rgba(255,255,255,1)"; const top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
this.detailElem.style["z-index"] = "4"; this.detailElem.style["transition"] = "0s";
this.detailElem.style.top = top - 1000 + "px";
setTimeout(function () {
_this.detailElem.style["transition"] = "0.7s";
_this.detailElem.style.top = top + "px";
_this.detailElem.children[0].innerHTML = data.title;
_this.detailElem.children[1].innerHTML = data.summary;
_this.detailElem.style.color = "rgba(255,255,255,1)";
_this.detailElem.style["z-index"] = "4";
}, 1);
}; };
showBackground = () => { showBackground = () => {

Loading…
Cancel
Save