I have the current issue: I define via CSS the current role for a div element
.divElement:before {
background-image: url(../images/triangle.png);
background-repeat: no-repeat;
content: "";
height: 20px;
left: 62%;
margin: 0 0 0 -50px;
position: absolute;
top: -20px;
width: 100px;
}
.divElement{
background: none repeat scroll 0 0 #FFF8D6;
border-radius: 10px 10px 10px 10px;
color: black;
font: 1em/1.4 Cambria,Georgia,sans-serif;
margin: 0px 500px 3em;
padding: 15px;
position: relative;
text-align: center;
}
I created this element dynamically using jQuery: $('<div class="divElement"><p><strong></strong></p></div>').appendTo(....) this works correctly. The issue becomes when using jQuery and I try to dynamically change the backgroung-image and the top attribute of the content before the divElement (which I define in CSS with :before)
I tried something like this for the background-image, but doesn't work:
$('.divElement:before').css('background-image', 'url(../images/triangle_reverse.png)');
How can I do that? Thank to all !!!
The following will search for all nodes with class .divElement, take the corresponding elements that appear before tem and change their background images. Is that what you're trying to accomplish?
$('.divElement').prev().css('background-image', 'url(../images/triangle_reverse.png)');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With