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 281 forks source link

Uncaught Elements not found #44

Closed knubie closed 10 years ago

knubie commented 10 years ago

Getting an error: Uncaught Elements not found when trying to initialize.

BackgroundCheck.init({
  targets: '.title'
});

Even though .title exists.

kennethcachia commented 10 years ago

Do you have any images on the page when you initialize it?

knubie commented 10 years ago

That may have been it, not seeing that error now that I've got images on the page. Thanks!

kennethcachia commented 10 years ago

No problem! :)

Querschlag commented 9 years ago

This issue still exists and has nothing to do with images. I set my target class in the initializer and when I load the page I get this error... There are images on my website for which I works as expected, but on I don't have an object with my target class on EVERY page. Shouldn't the initializer fail gracefully when there's DOM object with the target class?

dylanfisher commented 8 years ago

I agree about failing gracefully. Seems like counter-intuitive behavior that the background-checker breaks when no images are on a page, but the targets exist.