Search code examples
jquerycssblockopacity

jQuery CSS Opacity


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

Solution

  • 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.