kennethcachia / background-check

Automatically switch to a darker or a lighter version of an element depending on the brightness of images behind it.
http://kennethcachia.com/background-check/
MIT License
3.27k stars 282 forks source link

BackgroundCheck not finding background-image #96

Open H-Ray opened 7 years ago

H-Ray commented 7 years ago

Hi,

I've just stumbled across this and I can't seem to get it working at all - I've got a page full of background-images, and I need the fixed nav to respond once it goes over them.

You can see the page here: http://sp.thirdfloordigital.net/

Here's a sample debug from the page:

--- BackgroundCheck ---
background-check.min.js:5 onLoad event: undefined
background-check.min.js:5 Sorted: false
background-check.min.js:5 Drawing: http://sp.thirdfloordigital.net/img/monk-face.jpg
background-check.min.js:5 Skipping image - http://sp.thirdfloordigital.net/img/monk-face.jpg - area too small
background-check.min.js:5 Drawing: http://sp.thirdfloordigital.net/img/shadowplay-white.png
background-check.min.js:5 Skipping image - http://sp.thirdfloordigital.net/img/shadowplay-white.png - area too small
background-check.min.js:5 Drawing: http://sp.thirdfloordigital.net/img/shadowplay-black.png
background-check.min.js:5 Drawing: http://sp.thirdfloordigital.net/img/scrolldown.png
background-check.min.js:5 Duration: 1ms

It doesn't seem to be finding the majority of the images on the page.

Here's my code:

// Check all elements with a .target class against all images on a page
document.addEventListener('DOMContentLoaded', function () {
  BackgroundCheck.init({
    targets: '.fixed-logo',
      debug:true
  });
});

Any ideas?

jani937 commented 5 years ago

Did you get a solution for this error? am also getting the same error, not sure what am i doing wrong. If i just copy past example, it works but it won't when integrate it to my app.

cylott commented 4 years ago

Same