What's wrong? I want to change the opacity if #nav .drop
is display:block;
jQuery(document).ready(function(){ if (jQuery('#nav .drop').css('display') === 'block') { jQuery('#main').css('opacity') = '0.6'; } });
The fadeTo() method gradually changes the opacity, for selected elements, to a specified opacity (fading effect).
fadeTo() method animates the opacity of the matched elements. It is similar to the . fadeIn() method but that method unhides the element and always fades to 100% opacity.
To set the opacity of a background, image, text, or other element, you can use the CSS opacity property. Values for this property range from 0 to 1. If you set the property to 0, the styled element will be completely transparent (ie. invisible).
jQuery('#main').css('opacity') = '0.6';
should be
jQuery('#main').css('opacity', '0.6');
Update:
http://jsfiddle.net/GegMk/ if you type in the text box. Click away, the opacity changes.
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