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 is not finding my background-image #63

Open lonelyearth opened 9 years ago

lonelyearth commented 9 years ago

Hi Kenneth,

first of all thank you for this wonderfull project. Love it!

I still have a small problem though ... for you or the other guys it might be really simple to solve.

I have assigned a background image using CSS to my body. But thats the only image BackgroundCheck does not find.

capture

Currently I have this setup:

document.addEventListener('DOMContentLoaded', function () {

// Prepare BackgroundCheck BackgroundCheck.init({ targets: '.target', debug: true }); });

And I am setting the background image like this:

capture

Page to check: http://www.lonelyearth.de

What can I do?

Thank you so much ;) Max / Lonelyearth

randomobject commented 8 years ago

Hi - I had a similar issue and resolved it by specifying the class of the div containing the background image within 'images' option below.

    BackgroundCheck.init({
        targets: '.section--work-text',
        images: '.section--work-image'
    });

so .section--work-image belongs to a <div> containing a css set background image and not an <img>

hope that helps