I have a background-image in my carousel, and i'm trying to add a gradient to it using jQuery.
Here is the CCS code of the element i'm trying to edit:
element.style {
padding: 5% 5%;
margin: 0px 0%;
background-image: url(myImgUrl);
background-position: left top;
background-size: contain;
min-height: 427px;
}
This is how it should like in the end (after adding gradient)
background-image: linear-gradient(to bottom, rgba(0,0,0,0) 20%, rgba(0,0,0,1))+ url(myImgUrl)
Here is what I tried
jQuery(function(){
jQuery(".sa_hover_container").each(function){
var img = (this).css("background-image");
var newBackground = "linear-gradient(to bottom, rgba(0,0,0,0) 20%, rgba(0,0,0,1)), "+ img ;
(this).css(background-image,newBackground);
});
});
Is it even possible to do? if so, what am I doing wrong ?
Thanks!