When appending the .css() function in jQuery 1.4.4 will the .css() override each of the preceding css, or will it append it?
e.g.
$('.GhostIcon').css('opacity', '0.25').css('filter', 'alpha(opacity=25)').css('-khtml-opacity', '0.25').css('-moz-opacity', '0.25');
And secondly, does this have the same behaviour?
$('.GhostIcon').css('opacity', '0.25');
$('.GhostIcon').css('filter', 'alpha(opacity=25)');
$('.GhostIcon').css('-khtml-opacity', '0.25');
$('.GhostIcon').css('-moz-opacity', '0.25');
When appending the .css () function in jQuery 1.4.4 will the .css () override each of the preceding css, or will it append it? And secondly, does this have the same behaviour? Show activity on this post. Setting a CSS property on an element will not remove all the other properties it might already have. So yes, it's cumulative.
jQuery - css () Method 1 jQuery css () Method. The css () method sets or returns one or more style properties for the selected elements. 2 Return a CSS Property 3 Set a CSS Property 4 Set Multiple CSS Properties 5 jQuery Exercises 6 jQuery CSS Reference. For a complete overview of all jQuery CSS methods, please go to our jQuery HTML/CSS Reference.
append() - Create content with HTML, jQuery and DOM Insert content with the append() method. Append content using a function Using a function to insert content at the end of the selected elements.
The append () method inserts specified content at the end of the selected elements. Tip: To insert content at the beginning of the selected elements, use the prepend () method.
Setting a CSS property on an element will not remove all the other properties it might already have. So yes, it's cumulative. Of course setting a property that's already set will change the value, since you can't have the same property twice.
Edit: Also, you only need to set opacity. jQuery will take care of setting things for lesser browsers.
These styles are applied so that it will work cross browser way. Also you can append the CSS in a single go
$('.GhostIcon').css({'opacity': '0.25', 'filter': 'alpha(opacity=25)', '-khtml-opacity': '0.25', '-moz-opacity': '0.25'});
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