动画 gif 不再在 jquery .show() 上动画
据我所知,这只影响 IE 8。
使用以下代码,gif 会出现但不是动画(卡在一个位置):
$("#<%=assessmentListLinkClientID() %>").click(function(){
$("#assessmentListLoaderImg").show();
});
我还使用了 .css('display', 'block')
具有相同的结果。
是否有一种可接受的方法(也许比这更好)可以产生可靠的跨浏览器结果来显示动画 gif?
As far as I can tell this only affects IE 8.
Using the following code, the gif appears but is not animated (stuck in one position):
$("#<%=assessmentListLinkClientID() %>").click(function(){
$("#assessmentListLoaderImg").show();
});
I've also used .css('display', 'block')
with the same results.
Is there an accepted way (perhaps better than this) that produces reliable cross-browser results for showing an animated gif?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来这是解决这个问题的方法:
您需要重新设置图像标签的 src,这迫使 IE 再次渲染它,从而显示它动画。
It appears this is the way to solve this issue:
You need to re-set the src of the image tag, this forces IE to render it again and hence show it animated.
我不久前遇到了这个问题,虽然我没有解决它,但我最近在 jquery UI 中发现了一些东西,我打算进一步调查。 jQuery UI 引擎中似乎有一个设置可以将内容设置为隐藏在屏幕外,我想知道这是否可以解决 IE 无法正确渲染动画 gif 的问题,因为它们在渲染时不可见。我的理论是,如果它可见但“在屏幕外”,那么 IE 可能会将其渲染为动画,但对用户来说是不可见的。
链接在这里:
http://jqueryui.com/docs/Theming/API
这是我在这里考虑的布局助手:
.ui-helper-hidden-accessible:对元素应用可访问的隐藏(通过页面外的abs定位)
我不能保证这个答案,但它在我的解决方案列表中当我有机会时尝试一下。
如果您尝试此操作并取得任何成功,请告诉我:)
I had this problem a while ago and while I didn't solve it I did spot something in the jquery UI recently that I was going to investigate further. There seems to be a setting in the jQuery UI engine for setting things as hidden off-screen and I was wondering if that might get around the problem with IE not rendering animated gifs properly because they're invisible at render-time. My theory was that if it was visible but "off-screen" then IE might render it as animated but it would be invisible to the user.
The link is here:
http://jqueryui.com/docs/Theming/API
And it's the layout helper here that I'm thinking of :
.ui-helper-hidden-accessible: Applies accessible hiding to elements (via abs positioning off the page)
I can't vouch for this as an answer but it was on my list of solutions to try myself when I had the chance.
If you try this and have any success with it let me know :)