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

Owl Carousel combined with Background-Check: BackgroundCheck isn't initialised. #17

Closed rpkoller closed 10 years ago

rpkoller commented 10 years ago

Hi i've already read the issue about Flexslider and the hassle to get sliders working with Flexslider. Therefor i tried to follow the rough direction you've taken for Flexslider to give things a try with Owl Carousel (http://owlgraphic.com/owlcarousel/) as well. I think i've adhered more or less every step but in the end the console shows on "jQuery().BackgroundCheck" an "undefined" in return. i've used the following jQuery lines before:

$(document).ready(function() {
    $("#about-imp").owlCarousel({
        navigation:true,
        slideSpeed:300,
        paginationSpeed: 400,
        singleItem:true,
        afterInit: function(){
            BackgroundCheck.init({
              targets: '.owl-buttons div',
              images: '.owl-carousel img'
          });
        },
        afterUpdate: function() {
            BackgroundCheck.refresh();
        }
    });
});

AfterInit seems the only viable callback but no luck. So i wonder is the problem on the Owl Carousel side, or the BackgroundCheck side or is it just my configuration? I've thrown together a stripped down test case, but i've used codekit for concatenation ( https://dl.dropboxusercontent.com/u/8578/bkgrdCheck.zip ). Best regards Ralf

kennethcachia commented 10 years ago

Hey Ralf!

jQuery().BackgroundCheck will always return "undefined", but BackgroundCheck works.

As per Owl Carousel's docs, afterUpdate is an After responsive update callback which fires when you resize the window. Use afterMove instead and the callback will fire every time you click on an arrow.

Let me know if you're still having issues.

Kenneth

rpkoller commented 10 years ago

Hi Kenneth! Thanks for the quick reply. Well a combination of things puzzled me. At first i've overlooked to comment out a few owl carousel button related coloring; therefor the custom background colorings hadn't any effect. there for i thought the plugin hasn't loaded properly since the console showed undefined. ;) but good to know all is working as expected. but i still have one open issue getting things working properly and flawless. but i guess i open a separate issue since it is dealing with a different aspect. thanks again!

kennethcachia commented 10 years ago

No problem :) Please open another issue and I'll look into it.