是否显示:无仍然使用渲染性能 [英] Does display:none still use performance of rendering

查看:20
本文介绍了是否显示:无仍然使用渲染性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有这样的标记

<!--Flash 对象-->

浏览器是否仍会使用资源来加载 Flash 对象,或者会延迟到进行 javascript 调用以切换 dislplay:block;

现在请记住,我不是在谈论加载对象.我说的是渲染它.我澄清这一点的原因是,如果我将 flash 对象更改为 img 标记,它仍会下载资源.

这背后的主要原因是 responsive css design 一切都很好,将您的网站更改为适合屏幕的 css 布局,但渲染资源需要时间,我不确定浏览器如何处理资源下载只是未呈现.

解决方案

是的,当然,无论display"属性处于何种状态,Flash 资源(包括常规图像、音乐或其他内容)将始终呈现.

根据我的经验,显示"属性与急切/延迟加载"无关.如果你想在最后一刻渲染一个对象,我建议你使用 javascript 或其他一些方法.

Lets say i have markup such as this

<div style='display:none'>
    <!--Flash Object-->
</div>

Would the browser still use resources to load the Flash object, Or would it be delayed till a javascript call is made to switch the dislplay:block;

Now please bear in mind I am not talking about loading the object. I am talking about rendering it. The reason why i clarify this is because if I change the flash object to an img tag it would still download the resource.

The main reason behind this is responsive css design its all well and good changing your website to a css layout to suit the screen but rendering resources takes time and im not sure how browsers handle resources that are downloaded just not rendered.

解决方案

Yes , sure, whatever status the "display" attribute is, the flash resource(including regular image, or a music, or something else) will be always rendered.

For my experience, the "display" attribute has no business with "eager/delay loading". If you want to render an object at the last moment, I suggest you use javascript or some other approach.

这篇关于是否显示:无仍然使用渲染性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆