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

'Unknown property' #20

Closed BeatLaG closed 10 years ago

BeatLaG commented 10 years ago

Hi!

I´m using Background-Check in a project where I have some "targets" within a slider. These elements are working pretty well when I slide between images, I use the set method and refresh each time. I´m not sure if this is the best way, but it seems to work.

In other part I have 2 elements more that are over the images of the same slider (in other pages they can be single images, even videos). These elements are fixed and the images are displaced on scroll, so these elements need to listen the scroll event managed by the plugin. The most part of the time they work pretty well, but in some part of the scroll action the plugin returns this "Unknown property" and breaks/kills the plugin.

Do you know the reason of this? Did you experienced something similar in this sense?

The scroll listening is a very cool feature, but do you know if it affects the a general site performance?

Hope you can help with these details. I know this plugins does not make magics, but it is near!

Thanks a lot!

kennethcachia commented 10 years ago

Hi!

Glad to hear that you're finding this plugin useful!

When using BackgroundCheck with sliders, you should initially call .init() and then .refresh() after each transition. There is no need to use the .set() method unless you want to change the targets, the images that you're checking or other properties later on after initialization.

Unknown property is thrown when you use .set() with an attribute that does not exist, but it could be a bug. Do you have an example I can look into?

re: performance on scroll - BackgroundCheck will wait until you finish scrolling to avoid parsing the images multiple times.

BeatLaG commented 10 years ago

Hi Kenneth,

thank you very much for backing to me so quickly. I´m currently working on this project, so I will retake this issue and try another approach. I´m using around 5 different targets and initially no new elements need to come to the 'stage'.

I will let you know.

Thanks again! :)

kennethcachia commented 10 years ago

No problem! :)

I will close this issue for the time being, but feel free to add a comment here if you encounter any issues.