Search code examples
javascriptyuijavascript-frameworkyui2

How to create a Modality Mask in YUI2?


I want to know how a modality mask can be created in YUI2 without using a configuration attribute. While rendering a YUI Panel, the mask normally renders before the panel is displayed. I want to do this in order to resolve a cross browser compatibility issue.

Can anyone share a snippet for this?


Solution

  • Just figured out a way to do this.

    YUI container.js has various functions to deal with masks.

    buildMask()
    sizeMask()
    showMask()/hideMask()
    

    The only difference is I need to call them manually like below -

    var panel = new YAHOO.widget.Panel('nodeId', configs);
    ...
    panel.buildMask();
    panel.sizeMask();
    panel.bringToTop();
    panel.showMask();
    ...
    panel.render();