javascriptjquery

Use External CSS instead of inline CSS for blockUI


I am using blockUI in multiple places and they all have the same properties so i keep on repeating the same css values in all the place I use. is there a way to put it into a CSS file.

currently i use:

$.blockUI({
        message: $('#Something'),
        css: {
            border: '5px solid #F4712',
            backgroundColor: '#6F4712',
            width: '300px'
        }
    });

can i use like:

$.blockUI({
    message: $('#Something'),
        css: {
            class:"alertBox"
        }
    });

thanks


Solution

  • according to the documentation - you can't.

    but you to do that :

    the class $(".blockPage").addClass("myClass")
    

    p.s. be sure not to give any styles in the code as you wrote .

    and update to something like this :

      $.blockUI({ 
                fadeIn: 1000, 
                timeout:   2000, 
                onBlock: function() { 
                   $(".blockPage").addClass("myClass");
    
                } 
            });