jQuery CSS Opacity

Mike picture Mike · May 7, 2013 · Viewed 142.9k times · Source

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';
    }
});

Answer

rdp picture rdp · May 7, 2013
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.