Gregory's Blog

How to get both background and non-background images using the imagesLoaded library.

I use the imagesLoaded javascript library to determine when and what images are loaded and to provide a status on a pre-loader status screen. The imagesLoaded library has the ability to gather information on background images, and non-background images using the 'background: true/false' argument. If you need to get both background and non-background images, just run it twice switching the background arguments. I highly recommend using this library when you want to provide a 'please wait' dialog and show the load progress of a graphically intense site.

view plain about
1// Get the parallax images (non-background images).
2$('.images').imagesLoaded({
3    background: false
4}).progress( function( instance, image ) {
5    loadProgress();
6});
7
8// Get the background images in the scenes.
9$('.bcg').imagesLoaded({
10    background: true
11}).progress( function( instance, image ) {
12    loadProgress();
13});

This entry was posted on May 8, 2019 at 11:35 PM and has received 29 views.

There are currently 0 comments.




Your input and contributions are welcomed!

If you have an idea, BlogCfc based code, or a theme that you have built using this site that you want to share, please contribute by making a post here or share it by contacting us! This community can only thrive if we continue to work together.

Images and Photography:

Gregory Alexander either owns the copyright, or has the rights to use, all images and photographs on the site. If an image is not part of the "Gregory's Blog" open sourced distribution package, and instead is part of a personal blog post or a comment, please contact us and the author of the post or comment to obtain permission if you would like to use a personal image or photograph found on this site.

Credits:

Portions of Gregory's Blog are powered on the server side by BlogCfc, an open source blog developed by Raymond Camden. Revitalizing BlogCfc was a part of my orginal inspiration that prompted me to design this site. Some of the major open source contributers to BlogCfc include:

  1. Peter Farrell: the author of 'Lyla Captcha' that is used on this blog.
  2. Pete Freitag: the author of the 'ColdFish' code formatter that is also used on this blog.

Version:

Gregory's Blog Version 1.01 June 13, 2019 00:49 PST.