Surf - est le temps de chargement dans l'autre main - est le grand probl
- Demo
- Agrandir
- Recharger
- New window
Gratuit iPage hébergement Web pour la première année MOMENT
Si vous êtes toujours à la recherche d'un fournisseur d'hébergement Web fiable avec des tarifs abordables, pourquoi vous ne prenez pas un peu de temps pour essayer iPage, seulement avec $1.89/month, inclus $500+ Crédits supplémentaires gratuites pour le paiement de 24 mois ($45)?
Plus de 1.000.000 de clients + existisng peuvent pas avoir tort, vraiment vous n'êtes pas aussi! Plus important encore, lorsque vous enregistrez l'hébergement web à iPage grâce à notre lien, nous allons être heureux de renvoyer un plein remboursement. C'est génial! Vous devriez essayer iPage hébergement web GRATUITEMENT maintenant! Et contactez-nous pour tout ce que vous devez savoir sur iPage.
Preloading images is a great way to improve the user experience. When images are preloaded in the browser, the visitor can surf around your site and enjoy extremely faster loading times. This is especially beneficial for photo galleries and other image-heavy sites where you want to deliver the goods as quickly and seamlessly as possible. Preloading images definitely helps users without broadband enjoy a better experience when viewing your content. In this article, we'll explore three different preloading techniques to enhance the performance and usability of your site.
Method 1: Preloading with CSS and JavaScript
There are many ways to preload images, including methods that rely on Perishable Press, I have covered image preloading numerous times:
- Better Image Caching with CSS
- A Way to Preload Images without JavaScript that is SO Much Better
- Pure CSS: Better Image Preloading without JavaScript
- CSS Throwdown: Preload Images without JavaScript
- Preloading Images with CSS and JavaScript
Each of these techniques sort of builds on previous methods and remains quite effective and suitable for a variety of design scenarios. Thankfully, readers always seem to chime in on these posts with suggestions and improvements. Recently, Ian Dunn posted an article that improves upon my Better Image Preloading without JavaScript method.
With that method, images are easily and effectively preloaded using the following CSS:
By strategically applying preload
IDs to existing (X)HTML elements, we can use CSS' background
property to preload select images off-screen in the background. Then,
as long as the paths to these images remains the same when they are
referred to elsewhere in the web page, the browser will use the
preloaded/cached images when rendering the page. Simple, effective, and
no JavaScript required.
As effective as this method is, however, there is room for improvement. As Ian points out, images that are preloaded using this method will be loaded along with the other page contents, thereby increasing overall loading time for the page. To resolve this issue, we can use a little bit of JavaScript to delay the preloading until after the page has finished loading. This is easily accomplished by applying the Simon Willison's addLoadEvent() script:
In the first part of this script, we are setting up the actual preloading by targeting specific preload
elements with background
styles that call the various images. Thus, to use this method, you will need to replace the "preload-01
", "preload-02
", "preload-03
", etc., with the IDs that you will be targeting in your markup. Also, for each of the background
properties, you will need to replace the "image-01.png
", "image-02.png
", "image-03.png
", etc., with the path and name of your image files. No other editing is required for this technique to work.
Then, in the second part of the script, we are using the addLoadEvent()
function to delay execution of our preloader()
function until after the page has loaded.
SO what happens when JavaScript is not available on the user's browser? Quite simply, the images will not be preloaded and will load as normal when called in the web page. This is exactly the sort of unobtrusive, gracefully degrading JavaScript that we really like :)
- Sent (0)
- Nouveau
Save up to 630$ when buy new iPhone 15
GateIO.gomymobi.com
Free Airdrops to Claim, Share Up to $150,000 per Project
https://tooly.win
Open tool hub for free to use by any one for every one with hundreds of tools
chatGPTaz.com, chatGPT4.win, chatGPT2.fun, re-chatGPT.com
Talk to ChatGPT by your mother language
Dall-E-OpenAI.com
Generate creative images automatically with AI
AIVideo-App.com
Render creative video automatically with AI
JPEG instead of PNG Réponse
Wouldn't it be a way better solutoin to use JPEG images instead of PNG (as used in your example)? Of couse, the one might not outrule the other, but most visitors and sites and running with such fast internet connections that they could easily download/upload JPEG images. Anyway, a neat JavaScript guide.
Ehh Réponse