I'm working on the pseudo class element here on hover I want to change ::after
background color, I have tried but its is not working. Can anyone suggest me in the right direction why it is not working.
$(document).ready(function() {
$('.box').click(function() {
$('.box:after').css('background-color', 'yellow');
});
});
.box {
position: relative;
width: 50px;
height: 50px;
background-color: red;
}
.box:after {
content: '';
position: absolute;
top: 133%;
width: 50px;
height: 50px;
background-color: green;
}
.content {
position: absolute;
left: 50px;
width: 0;
height: 50px;
background-color: blue;
transition: all 0.5s linear;
}
.box:hover .content {
width: 600px;
transition: all 0.5s linear;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<div class="box">
<div class="content"></div>
</div>