简体   繁体   English

如何首先在网页中加载图像

[英]how to first load an image in webpage

i have a question to ask you. 我有一个问题要问你。 So I have on my webpage a showcase that has some images that keep playing. 因此,我的网页上有一个展示柜,其中包含一些不断播放的图像。 I used JCarousel to build it. 我用JCarousel来构建它。 The thing is that when i first enter on the page i can't see the image or I see only a part of it. 问题是,当我第一次进入页面时,我看不到图像,或者只看到了一部分。 I suspect that this is because the site a few seconds while it loads all the images it has. 我怀疑这是因为该站点在加载它拥有的所有图像时需要花费几秒钟的时间。
My question is: how can I make certain images be the first ones to be loaded? 我的问题是:如何使某些图像成为第一个要加载的图像? Or how can I prioritise the way the images load on the page? 或者如何确定图像在页面上的加载方式的优先级? By the way I'm doing this in html,php using javascript and ajax and the images are taken from a database. 顺便说一下,我正在使用javascript和ajax在html,php中执行此操作,并且图像是从数据库中获取的。
Thank you very much! 非常感谢你!

If you Base64 encode them, you can put them in the CSS, or HTML. 如果对它们进行Base64编码,则可以将它们放入CSS或HTML中。 It will really increase the side of a page, so perhaps encode a low resolution picture, and then replace it with highres when it loads. 它将确实增加页面的宽度,因此也许编码低分辨率的图片,然后在加载时将其替换为高分辨率。 That is, a preview image. 即,预览图像。

Try this tool/guide . 尝试使用此工具/指南

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM