DataGrid点击上下一页loading效果

本文介绍如何使用JS创建一个动态加载显示组件,并在页面请求开始和加载完成时进行展示与隐藏,提高用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

js添加显示loading和取消loading方法

 1         function showtbloading() {
 2             var target = $("#GridView1");
 3             if (target.length <= 0) {
 4                 $("#tbloading").width($(window).width());
 5                 $("#tbloading").height($(window).height());
 6 
 7             } else {
 8                 $("#tbloading").width(target.width());
 9                 $("#tbloading").height(target.height());
10                 $("#tbloading").css("left", target.offset().left + "px");
11                 $("#tbloading").css("top", target.offset().top + "px");
12             }
13             $("#tbloading").find("div").eq(0).css("top", ($("#tbloading").height() - 32) / 2);
14             $("#tbloading").show();
15         }
16         function hidetbloading() {
17             $("#tbloading").hide();
18         }

html添加loading效果div

        <div id="tbloading" style="position: absolute; top: 0px; left: 0px; filter: Alpha(opacity=50);
            -moz-opacity: 0.5; opacity: 0.5; background: #777; background-color: White; z-index: 1000;
            display: none;">
            <div style='width: 32px; height: 32px; left: 50%; position: relative; text-align: center;'>
                <center>
                    <img src='/pic/Rotate.gif' alt="" /><br />
                    <span style='font-size: 13px; font-weight: bolder; width: 100%; text-align: center;'>
                    </span>
                </center>
            </div>
        </div>

js注册事件

1         Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(PageLoadingHandler);
2         function PageLoadingHandler(sender, args) {
3             showtbloading();
4         }
5         Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(EndRequest);
6         function EndRequest(sender, args) {
7             hidetbloading();
8         }

 

转载于:https://www.cnblogs.com/servant/p/3829191.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值