How can I chnage a Pseduo-class, like ::after, in Javscript in the following 5 seconds, considering that I want to build a a start-up transition .
I want to chnage .title::after
's left from 69% to -50vh . I tried to select .title::after
with querySelector, but it didn't work . I tried of course to search what I want to do but I eneded up with nothing functional .
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="content">
<div class="intro">
<h1 class="title">Programming</h1>
<h3 class="subtitle">REINVENTED</h3>
</div>
</div>
<script src="index.js"></script>
</body>
</html>
CSS:
body {
font-family: 'Montserrat', sans-serif;
background: #141414;
width: 100%;
height: 100%;
overflow: hidden;
}
.intro {
mask: url(.mask);
mask-type: luminance;
mask-mode: alpha;
margin: 0;
position: absolute;
top: 50%;
left: 40%;
transform: translate(-50%, -50%);
}
.intro h1 {
color: white;
font-weight: 800;
font-size: 7em;
}
.intro h3 {
color: white;
font-weight: 300;
font-size: 3.5em;
position: absolute;
left: 37.7vw;
top: 20vh;
}
.intro h1::after {
content: "";
backdrop-filter: invert(100%);
position: absolute;
bottom: -50vh;
left: 69%;
margin-left: -50px;
width: 320px;
height: 150vh;
z-index: 2;
transition-delay: 2s;
transition-duration: 1s;
transition-timing-function: ease-in-out;
}
.transitioned {
content: "";
backdrop-filter: invert(100%);
position: absolute;
bottom: -50vh;
left: -320PX;
margin-left: -50px;
width: 320px;
height: 150vh;
z-index: 2;
}