为增强用户体验,在页面发送ajax 请求时,出现"操作"提示,ajax 结束时,隐藏"操作"提示。

1.HTML 代码

<!--ajax提示层-->
<div class="ajaxDiv" >
操作中....
</div>

2. 样式

div.ajaxDiv
{
    position:absolute;
    left:0px;
    top:0px;
    width:100%;
    height:100%;
    background:#567 url(../images/Loading.gif) no-repeat center center;
    display:none;
    z-index:9999;
    color:red;
    text-align:center;
    vertical-align:middle;
    font-size:12px;
    line-height:100%;
}

3.JS 代码

    $.ajaxSetup({cache:false});
    $("#ajaxDiv").ajaxStart(function () {
        var h = $(document).height();
        $(this).height(h).css({ "opacity": 0.8, "line-height": h + 'px' }).show();
    }).ajaxStop(function () {
        $(this).hide();
    });

4.结果

为页面添加ajax 操作提示

相关文章:

  • 2022-02-06
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2021-04-28
  • 2021-11-28
  • 2021-07-10
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2021-08-22
  • 2021-06-04
  • 2022-12-23
  • 2022-02-28
相关资源
相似解决方案