隐藏的 GIF 动画还占用 CPU 吗?
我有一个 AJAX 密集型网站。当服务器处理请求时,有数百个按钮会立即显示动画加载 GIF。
我注意到我的网站在使用几分钟后变得缓慢。动画 GIF 以较低的帧速率播放。他们有时甚至停止动画。按钮上的悬停效果有明显的滞后。是否有可能这数百个动画 GIF 即使在隐藏时仍会锁定 CPU(style="display: none"
)?在任何时间点最多只能看到几个 GIF。
I have an AJAX heavy website. There's hundreds of buttons that momentarily put up an animated loading GIF when the server is processing a request.
I noticed that my site is sluggish after using it for several minutes. The animated GIFs play at lower framerate. They sometimes even stop animating. Hover effects on buttons have a noticeable lag. Is it possible that these hundred animated GIFs are still locking up the CPU even while they're hidden (style="display: none"
)? At most, only a few GIFs are visible at any point in time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用样式表隐藏的内容仍然存在于浏览器中,并由浏览器解析(因此可以通过脚本进行操作),只是不向用户显示。
这与控件被标记为
.visible=false
时相反,在这种情况下,它们未在浏览器中标记(因此不能由脚本操作)Things that are hidden using style-sheets still exist in, and are resolved by the browser (and can therefore be manipulated by script), they are just not displayed to the user.
This is in contrast to when controls are marked as
.visible=false
in which case they are not marked up in the browser (and therefore cannot by manipulated by script)