question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Background load is not detected. Always calls the 'isLoaded' callback.

See original GitHub issue

Hello,

thanks for the great piece of the code of yours 💯

Though I found imagesloaded, while in the background mode does not detect if the image is loaded. Either it is or it is not, or even when the element does not have any background, the callback function signals in all the cases that the bg is loaded.

Here is the reduced test case on CodePen based on your recommended example.

Can you please kindly check and fix this or tell if I do something wrong?

Thanks again, Val

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
Michas0206commented, Jun 6, 2018

Same problem here. Why is it still not being fixed? This plugin is completely useless - it runs my function even if the picture is not loaded (or also if there is no picture at all or the complete div does not exist).

0reactions
shockthetoastcommented, Nov 13, 2018

I can confirm that this is not working for background images. It is triggering “done” long before the image actually loads. I am dynamically creating a number of DIVs and applying a “background-image” to each. If I use Chrome’s developer tools to set “Fast 3G”, there are a few seconds between “done” triggering and the images finishing to load/displaying.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I check if a background image is loaded?
I have a jQuery plugin called waitForImages that can detect when background images have downloaded. $( ...
Read more >
Lazy Loading Images – The Complete Guide - ImageKit.io
An image, not visible to the user when the page loads, is loaded later ... Here is a working example that lazy loads...
Read more >
Introduction: callbacks - The Modern JavaScript Tutorial
The onload event is described in the article Resource loading: onload and onerror, it basically executes a function after the script is loaded...
Read more >
Detect when images have finished loading with React
componentDidMount() is called when your React component is rendered. ... In case it's not clear yet, render is always before load.
Read more >
next/image - Next.js
Firefox 67+ displays a white background while loading. Possible solutions: ... A callback function that is invoked when the image is loaded.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found