JSFiddle - React, Tailwind, and code Playground
HTML
<div class="xxx"><img src="http://mywishlist.ru/pic/i/wish/orig/006/372/981.jpeg"></div>
CSS
.xxx img {
opacity:.05
}
.xxx:before {
opacity;1;
position: absolute;
margin: 0;
padding: 0;
content: "не смотреть, если нет 18 лет";
font-size:30px;
color:red;
top: 20%;
left: 20%;
display: block;
}
.yyy:before {
}
JavaScript
document.onclick = function replaceClass() {
var elements = document.getElementsByClassName("xxx");
if (elements[0]) {
elements[0].className = "yyy";
replaceClass();
}
};