fiddle: https://jsfiddle.net/jzhang172/708p96v3/
I'm trying to change the :before background-color using jquery and javascript. From what I've researched, people say it's not possible. How do I change the color of the tint of this image then? If it's possible to do without :before, then that's also fine.
$(function(){
$('.div:before').addClass('wto');
$('.div').css('background-color','orange');
});
.div{
height:500px;
width:500px;
background:url('http://movieboozer.com/wp-content/uploads/2015/05/my-neighbor-totoro-main-review.jpg');
position:Relative;
}
.div:before{
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
content:"";
background:rgba(22, 255, 171, 0.88);
transition:2s;
}
.div:hover:before{
background:red;
}
body,html{
position:Relative;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script>
<div class="div"></div>