[英]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.