I'm curious as to why the element's opacity is not temporarily reduced when the corresponding button is pressed. Any assistance would be greatly appreciated.
function pause(miliseconds) {
var currentTime = new Date().getTime();
while (currentTime + miliseconds >= new Date().getTime()) {}
}
function fadeOutFadeIn(ev) {
document.getElementById(ev).style.opacity = '0.16';
pause(1500);
document.getElementById(ev).style.opacity = '1';
}
<div id="epicenter">
<img src="https://via.placeholder.com/45/000" alt="Black" id="black">
<img src="https://via.placeholder.com/45/00f" alt="Blue" id="blue">
<img src="https://via.placeholder.com/45/0f0" alt="Green" id="green">
<img src="https://via.placeholder.com/45/ddd" alt="Grey" id="grey">
<img src="https://via.placeholder.com/45/a0d" alt="Purple" id="purple">
<img src="https://via.placeholder.com/45/e73" alt="Orange" id="orange">
<img src="https://via.placeholder.com/45/f00" alt="Red" id="red">
<img src="https://via.placeholder.com/45/ff0" alt="Yellow" id="yellow">
<img src="https://via.placeholder.com/45/fcc" alt="Pink" id="pink">
</div>
<button onclick="fadeOutFadeIn('black')">black</button>
<button onclick="fadeOutFadeIn('blue')">blue</button>
<button onclick="fadeOutFadeIn('green')">green</button>
<button onclick="fadeOutFadeIn('grey')">grey</button>
<button onclick="fadeOutFadeIn('purple')">purple</button>
<button onclick="fadeOutFadeIn('orange')">orange</button>
<button onclick="fadeOutFadeIn('red')">red</button>
<button onclick="fadeOutFadeIn('yellow')">yellow</button>
<button onclick="fadeOutFadeIn('pink')">pink</button>