Update: Nicer play button

pull/16/head
Juraj Nyíri 4 years ago
parent faf31facbb
commit aef2125332

@ -63,10 +63,16 @@ class ContentCardExample extends HTMLElement {
"float:left; width:138px; height:206px; margin-right:10px; margin-bottom:10px; background-image: url('" + "float:left; width:138px; height:206px; margin-right:10px; margin-bottom:10px; background-image: url('" +
thumbSmall + thumbSmall +
"'); background-repeat: no-repeat; background-size: contain;"; "'); background-repeat: no-repeat; background-size: contain;";
movieElem.innerHTML = data.title;
const playButton = this.getPlayButton(); const playButton = this.getPlayButton();
movieElem.append(playButton); const titleElem = document.createElement("div");
titleElem.innerHTML = data.title;
const interactiveArea = document.createElement("div");
interactiveArea.className = "interactiveArea";
//interactiveArea.append(titleElem);
interactiveArea.append(playButton);
movieElem.append(interactiveArea);
const _this = this; const _this = this;
movieElem.addEventListener("click", function (event) { movieElem.addEventListener("click", function (event) {
@ -91,14 +97,31 @@ class ContentCardExample extends HTMLElement {
let style = document.createElement("style"); let style = document.createElement("style");
style.textContent = ` style.textContent = `
.interactiveArea {
position: relative;
width: 100%;
height: 100%;
transition: 0.5s;
display: flex;
align-items: center;
justify-content: center;
}
.interactiveArea:hover {
background: rgba(0,0,0,0.3);
}
button[name="playButton"] { button[name="playButton"] {
width: 50px; width: 40px;
height: 50px; height: 40px;
background: red; background: rgba(0,0,0,0.4);
border: none; border: 2px solid white;
border-radius: 100%; border-radius: 100%;
margin: auto; margin: auto;
cursor: pointer; cursor: pointer;
transition: 0.2s;
}
button[name="playButton"]:hover {
background: orange;
border: 2px solid orange;
} }
button[name="playButton"]:focus { button[name="playButton"]:focus {
outline: 0; outline: 0;
@ -111,10 +134,15 @@ class ContentCardExample extends HTMLElement {
display: inline-block; display: inline-block;
position: relative; position: relative;
top: 1px; top: 1px;
left: 3px; left: 2px;
border-style: solid; border-style: solid;
border-width: 10px 0 10px 20px; border-width: 6px 0 6px 12px;
border-color: transparent transparent transparent white; border-color: transparent transparent transparent white;
transition: 0.2s;
}
button[name="playButton"]:hover:after {
border-color: transparent transparent transparent black;
}`; }`;
this.appendChild(style); this.appendChild(style);

Loading…
Cancel
Save