简体   繁体   English

使用JQuery的Gridview加载动画是静止帧,即不进行动画处理

[英]Gridview loading animation using JQuery is a still frame i.e. does not animate

Hello and thanks for looking. 您好,感谢您的光临。

In my earlier project, I was using an UpdatePanel to show the loader gif when I was busy creating data to bind my Gridview with. 在我较早的项目中,当我忙于创建数据以绑定Gridview时,我正在使用UpdatePanel显示加载程序gif。 I wanted to move this part of the code over to JQuery so I replace the UpdatePanel with an img tag linking to the gif after looking at this solution ( Page loading animation ) 我想将这部分代码移到JQuery上,因此在查看此解决方案后,我用链接到gif的img标签替换了UpdatePanel( 页面加载动画

In my index.html page I had 在我的index.html页面中,

        <script>

        $(document).ready(function () {
            $('#loadingImage').hide();
        });

        function ShowLoaderImage() {
            $('#loadingImage').show();
        }
    </script>

and I called ShowLoaderImage from the asp:Button I was using to populate the source of the Gridview. 然后我从用来填充Gridview源的asp:Button调用ShowLoaderImage。

<asp:Button ID="View_Data_Button" CssClass="dataButton" OnClick="View_Data_Button_Click" OnClientClick="ShowLoaderImage()" runat="server" Text="View Data" />

I expected the image to start spinning when I click the button to load the GridView, and disappear when done loading the GridView since document.ready is raised then as well. 我希望图像在单击按钮以加载GridView时开始旋转,而在加载GridView时消失,因为document.ready也随之升高。 Instead, I see a frozen frame of the gif--no animations. 相反,我看到了gif的冻结帧-没有动画。 How can I fix this? 我怎样才能解决这个问题?

I suggest to replace the html in the element 我建议替换元素中的html

        $('#data_loding_div').html('<img  alt="loadingImage" src="/images/loadingImage.gif" />')

After getting data, 取得资料后

 $('#data_loding_div').html(data); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jQuery动画不动画 - jquery animation does not animate 使用animate()的jQuery动画 - Jquery animation using animate() 在greasemonkey中使用jQuery插件(即tipsy) - Using jQuery plugins in greasemonkey (i.e. tipsy) JQuery-Animate()函数仍然在.not(...)、. not(&#39;...&#39;)、: not(...)和:not(&#39;...&#39;)元素上执行动画 - JQuery - Animate() function still performs an animation on the .not(…), .not('…'), :not(…) and the :not('…') elements 使“忙碌等待”动画在jquery中“位置可配置”的最佳方法? (即,显示操作的位置) - Best way to have 'busy waiting' animation be 'position configurable' in jquery? (i.e., show it where the action is) 使用请求动画帧在画布中为圆动画 - animate a circle in canvas using request animation frame 如何通过动画动态加载页面元素(即图像)? - How to dynamically load in page elements (i.e. images) with an animation? 为什么jQuery load()方法具有多个sprite(即bool)? - Why does the jQuery load() method with multiple sprites (i.e., a bool)? jQuery中的方法链接是否会导致多个循环,即每个方法一个循环 - Does method chaining in jQuery result in multiple loops i.e. one for each method 使用Blazor(即WebAssembly)+ JavaScript - Using Blazor (i.e. WebAssembly) + javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM