AJAX阻止div问题

时间:2014-07-21 18:42:14

标签: javascript jquery html css ajax

使用以下CSS无法使用AJAX阻塞div ...任何线索? 谢谢!

HTML

<div id="busy"></div>

JavaScript

 $.ajaxSetup({
            beforeSend: function () { 
                $("#busy").show();
            },
            complete: function () { 
                $("#busy").hide();
            }
        });

CSS

#busy {
    width:100%;
    height:100%;
    opacity: 0.4;
    filter: alpha(opacity=40); /* For IE8 and earlier */
    background-color:grey;
    z-index:9999;
}

1 个答案:

答案 0 :(得分:3)

您的元素位置static,需要定位relativeabsolutefixed以获得维度

#busy {
    position: absolute;
    width:100%;
    height:100%;
    opacity: 0.4;
    filter: alpha(opacity=40); /* For IE8 and earlier */
    background-color:grey;
    z-index:9999;
}