I can’t remember where that came from and was probably focused on its original concept.
As usual values will rely on the task in hand and what needs to be achieved. The problem with using min-width:40% when the page is very wide is that the min-width may then be wider than the max-width and the max-width will be ignored. This may indeed be what you wanted but without full context it may be that you don’t want it bigger than 560px in which case the min-width would need to be changed to perhaps a px width.
If perhaps someones monitor was very wide say 3000px plus and you wanted the element to take up at least 40% of the screen rather than the 560px you set which would look a bit lost on a very large screen
The container has no actions applied to it so the border won;t change. You would need to use JS to add a class to the container when the youtube is clicked and then use that class to color the border. This is more of a JS question than a CSS one.
.container.highlight{border-color:red;}
Then change the js so that the container is clicked and that allows you to add a class to it.
(function iife() {
"use strict";
let theContainer = document.querySelector('.container');
let youtube = document.querySelector('.youtube');
let thumbnail = `https://i.imgur.com/AJDZEOX.jpg`;
let image = new Image();
image.src = thumbnail;
image.addEventListener('load', function() {
youtube.appendChild(image);
});
theContainer.addEventListener('click', function() {
let iframe = document.createElement('iframe');
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('src', `https://www.youtube-nocookie.com/embed/M7lc1UVf-VE?rel=0&autoplay=1&controls=1&iv_load_policy=3&cc_load_policy=0&fs=0&disablekb=1&enablejsapi=1`);
youtube.innerHTML = '';
youtube.appendChild(iframe);
this.classList.add("highlight");
});
}());
You can’t transition an element that was previously display:none because there is no to or from state that will create an transition. You would need to hide the item off-screen rather than display:none and then you can transition the border and opacity as required.
If I wanted to change the line color on load, what style property would I target to do that?
function changeLineColor(playerStatus) {
let color;
if (playerStatus === 1) {
color = "green";
}
if (color) {
document.querySelector(".wrapg .lines").style.backgroundColor = color;
}
}
I did this one right:
function changeBorderColor(playerStatus) {
let color;
if (playerStatus === 1) {
color = "yellow";
}
if (color) {
document.querySelector(".wrapg.border").style.borderColor = color;
}
}
It changes to cursor:pointer once the iframe has loaded. I don’t think you will be able to keep the cursor the same while its loading because obviously it can’t be clicked until its finished loading unless you shim something over the top like the lines.