Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery UI API - Stacking Elements

jQuery UI API - Stacking Elements

Widgets that stack or move in front of other elements often face challenges when placed in real-world pages. Conflicts on the page are usually avoided by simply changing the stacked element's z-index or parent element. However, jQuery UI needs a general solution that does not require manually changing z-index values. This is accomplished through the ui-front class, usually accompanied by the appendTo option.

ui-front class

ui-front class on the stacking component. The class is very basic. It simply sets a static z-index value on the element. However, the presence of the class indicates where the stacked element should be appended. This allows us to take advantage of nested stacking contexts and generate a default DOM position that works in most cases.

Note: When using ui-front , you must set position is relative、 absolute or fixed, so that the z-index。

stacking technique

Any widget that appends stacked elements to the page must use the ui-front class and, in most cases, should have an appendTo option. Stacked elements should follow these rules:

- If an element with the `ui-front` class is found, append to that element. - If no element with the `ui-front` class is found, append to the body.