Coder Social home page Coder Social logo

Comments (5)

 avatar commented on May 31, 2024

Yup same error for me:

"Uncaught Element is not an <img> but does not have a background-image"

In my case the script breaks. I assume it's some kind of conflict with other scripts on the site as it works on the blog section. I'll report back if I track the conflict down.

from background-check.

dagomar avatar dagomar commented on May 31, 2024

I had the same issue. It is because the script throws an error if it doesn't find the elements. However in my case I just don't care if it doesn't find anything, I don't want that all my scripts suddenly stop working because of this. I adjusted line 167 and 189 to not throw an error. (just commented the lines with 'throw' out). Perhaps it should only inform the user when debug is enabled? Are there any side effects in removing the throw declarations?

from background-check.

princeofnaxos avatar princeofnaxos commented on May 31, 2024

Since it is quite impossible to always have all elements in all pages of a website, the script should definitely not throw "Uncaught" errors. Just quietly ignore the "not found" elements seems better.

from background-check.

oddpixel avatar oddpixel commented on May 31, 2024

I got around this by checking for the class name that triggers the script before initializing it on a page. Definitely agree that it should just fail gracefully if nothing is found.

if( $('.bgcheck')[0] ) {
    BackgroundCheck.init({
        targets: '#back-to-top',
        images: '.bgcheck',
        threshold: 70
    });
}

from background-check.

sasoriza avatar sasoriza commented on May 31, 2024

I had the same problem and could only fix it by adding the background-image property inlined instead of declaring it in my stylesheet

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.