Coder Social home page Coder Social logo

Comments (7)

kennethcachia avatar kennethcachia commented on May 31, 2024

Hey,

Hmm not sure. Could you give me a link to this site so I can test it further pls?

from background-check.

flayks avatar flayks commented on May 31, 2024

Hey!
Sorry for the delay. I almost finished my portfolio, I debugged some things but I always have the problem with the BackgroundCheck plugin.

http://flayks.com/v7/photo/isole-egadi

When you go to a next/previous picture, the debug (console log) says this : "Skipping image - http://blah/image.jpg - area too small".
I do a BackgroundCheck.refresh() with the plugin waitForImages, so normally it will runs the function after all the loaded content. I tested without waitForImages, but same.
But apparently, the plugin considers that the AJAX loaded background-image is simply not loaded (in this photo "Isole Egadi" the image is DSC_9639, the next "Une descente aux Enfers" is DSC_8443).
It only works on the first page load.

I don't know why…

from background-check.

flayks avatar flayks commented on May 31, 2024

Ok, I found a solution without any plugin (I juste set a class for each photo I use, if it's a dark or light picture), but if you have an idea, I'm curious.

from background-check.

kennethcachia avatar kennethcachia commented on May 31, 2024

Hey!

I checked your portfolio and noticed the following:

  • You're initializing BackgroundCheck with targets: #body, which will scan the entire visible portion of the image and add a light/dark class to <body>. I don't think this is what you're after as I'm assuming that you want to change the color of ex: #controls depending on the image portion it's currently on top of. Try the following instead:
BackgroundCheck.init({
  targets: "#controls",
  images: "#thephoto"
});
.detail.photo #controls.background--light a {
  background-color: #000;
}

.detail.photo #controls.background--light p {
  background-color: #000;
  color: #fff;
}
  • You're replacing the content of #main each time you load a new image and BackgroundCheck no longer has access to the required elements. Try replacing BackgroundCheck.refresh() with:
BackgroundCheck.set('targets', '#controls');
BackgroundCheck.set('images', '#thephoto');

which automatically reprocesses the image.

Hope this helps!

from background-check.

flayks avatar flayks commented on May 31, 2024

Thank you for the help! I will test your solution.
I use the body as target because I also change the color of my SVG logo, so with the body class .light or .dark, I change both logo and controls.

.light #logo path{fill:#fff}
.light #controls a{background:#fff; color:@darkblue}
.dark #logo path{fill:@darkblue}
.dark #controls a{background:@darkblue; color:#fff}

from background-check.

flayks avatar flayks commented on May 31, 2024

Yay, apparently it works pretty well.
Ty :}

from background-check.

kennethcachia avatar kennethcachia commented on May 31, 2024

Awesome!

re: targeting your SVG Logo - you should also target it on it's own so that it's more accurate. I usually add a .target class to all the elements that I need to check and then use the following:

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

from background-check.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.