Giter Site home page Giter Site logo

Comments (7)

imsky avatar imsky commented on September 26, 2024

Can you give an example of how you'd want this to work?

from holder.

pfk-beta avatar pfk-beta commented on September 26, 2024

I placed in css something like this:
background-image: url('holder.js/200x300');
Then Holder checks all element in DOM, in searching css atribute background-image. If found, it changes it. And I'm wondering whether is it worthwhile.

from holder.

imsky avatar imsky commented on September 26, 2024

It's an interesting idea, though it requires a fair amount of additional processing. I'll see if I can get this into 1.4.

from holder.

timiles avatar timiles commented on September 26, 2024

I need this too - in the meantime, I have worked around this with custom js (requires jQuery):

            var backgroundImageContainer = $("<div>").attr("id", <some_unique_id>).addClass("hidden");
            $("body").append(backgroundImageContainer);
            Holder.add_image("holder.js?200x200", "#" + backgroundImageContainer.attr("id")).run();
            $(<my_element_selector>).css("background-image", "url(" + $("img", backgroundImageContainer).attr("src") + ")");
            backgroundImageContainer.remove();

from holder.

jasperkennis avatar jasperkennis commented on September 26, 2024

Compass allows for inline images to be declared right into the css. I don't know how it works, but it might be of help to have a look in te the source if the proposed functionality is to be included into holder.

from holder.

imsky avatar imsky commented on September 26, 2024

@jasperkennis Compass encodes the image file using Base64 and embeds it using the data URI scheme. To mirror the same functionality, Holder would need to parse CSS, which at this stage would be unnecessary. I've already tested the CSS placeholder approach, it works, and will be included in 1.4 as soon as possible.

from holder.

imsky avatar imsky commented on September 26, 2024

This is now implemented, see https://github.com/imsky/holder#background-placeholders

from holder.

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.