Code Monkey home page Code Monkey logo

holder's Introduction

Holder

Holder renders image placeholders in browser using SVG.

Used by thousands of open source projects (including Bootstrap v3) and many other sites.

No extra requests, small bundle size, highly customizable.

npm Travis Build Status Package Quality NerdyData Popularity jsDelivr Hits

Installing

Usage

Include holder.js in your HTML:

<script src="holder.js"></script>

Holder will then process all images with a specific src attribute, like this one:

<img src="holder.js/300x200">

The above tag will render as a placeholder 300 pixels wide and 200 pixels tall.

To avoid console 404 errors, you can use data-src instead of src.

Programmatic usage

To programmatically insert a placeholder use the run() API:

var myImage = document.getElementById('myImage');

Holder.run({
  images: myImage
});

Placeholder options

Placeholder options are set through URL properties, e.g. holder.js/300x200?x=y&a=b. Multiple options are separated by the & character.

  • theme: The theme to use for the placeholder. Example: holder.js/300x200?theme=sky
  • random: Use random theme. Example: holder.js/300x200?random=yes
  • bg: Background color. Example: holder.js/300x200?bg=2a2025
  • fg: Foreground (text) color. Example: holder.js/300x200?fg=ffffff
  • text: Custom text. Example: holder.js/300x200?text=Hello
  • size: Custom text size. Defaults to pt units. Example: holder.js/300x200?size=50
  • font: Custom text font. Example: holder.js/300x200?font=Helvetica
  • align: Custom text alignment (left, right). Example: holder.js/300x200?align=left
  • outline: Draw outline and diagonals for placeholder. Example: holder.js/300x200?outline=yes
  • lineWrap: Maximum line length to image width ratio. Example: holder.js/300x200?lineWrap=0.5

Themes

Holder includes support for themes, to help placeholders blend in with your layout.

There are 6 default themes: sky, vine, lava, gray, industrial, and social.

Customizing themes

Themes have 5 properties: fg, bg, size, font and fontweight. The size property specifies the minimum font size for the theme. The fontweight default value is bold. You can create a sample theme like this:

Holder.addTheme("dark", {
  bg: "#000",
  fg: "#aaa",
  size: 11,
  font: "Monaco",
  fontweight: "normal"
});

If you have a group of placeholders where you'd like to use particular text, you can do so by adding a text property to the theme:

Holder.addTheme("thumbnail", { bg: "#fff", text: "Thumbnail" });

Using custom themes

There are two ways to use custom themes with Holder:

  • Include theme at runtime to render placeholders already using the theme name
  • Include theme at any point and re-render placeholders that are using the theme name

The first approach is the easiest. After you include holder.js, add a script tag that adds the theme you want:

<script src="holder.js"></script>
<script>
Holder.addTheme("bright", {
  bg: "white", fg: "gray", size: 12
});
</script>

The second approach requires that you call run after you add the theme, like this:

Holder.addTheme("bright", {bg: "white", fg: "gray", size: 12}).run();

Using custom themes and domain on specific images

You can use Holder in different areas on different images with custom themes:

<img data-src="example.com/100x100?theme=simple" id="new">
Holder.run({
  domain: "example.com",
  themes: {
    "simple": {
      bg: "#fff",
      fg: "#000",
      size: 12
    }
  },
  images: "#new"
});

Inserting an image with custom theme

You can add a placeholder programmatically by chaining Holder calls:

Holder.addTheme("new", {
  fg: "#ccc",
  bg: "#000",
  size: 10
}).addImage("holder.js/200x100?theme=new", "body").run();

The first argument in addImage is the src attribute, and the second is a CSS selector of the parent element.

Text

Holder automatically adds line breaks to text that goes outside of the image boundaries. If the text is so long it goes out of both horizontal and vertical boundaries, the text is moved to the top. If you prefer to control the line breaks, you can add \n to the text property:

<img data-src="holder.js/300x200?text=Add \n line breaks \n anywhere.">

If you would like to disable line wrapping, set the nowrap option to true:

<img data-src="holder.js/300x200?text=Add \n line breaks \n anywhere.&amp;nowrap=true">

When using the text option, the image dimesions are not shown. To reinsert the dimension into the text, simple use the special holder_dimensions placeholder.

<img data-src="holder.js/90px80p?theme=sky&text=Placeholder dimensions: holder_dimensions">

Placeholders using a custom font are rendered using canvas by default, due to SVG's constraints on cross-domain resource linking. If you're using only locally available fonts, you can disable this behavior by setting noFontFallback to true in Holder.run options. However, if you need to render a SVG placeholder using an externally loaded font, you have to use the object tag instead of the img tag and add a holderjs class to the appropriate link tags. Here's an example:

<head>
<link href="http://.../font-awesome.css" rel="stylesheet" class="holderjs">
</head>
<body>
<object data-src="holder.js/300x200?font=FontAwesome"></object>

Important: When testing locally, font URLs must have a http or https protocol defined.

Important: Fonts served from locations other than public registries (i.e. Google Fonts, Typekit, etc.) require the correct CORS headers to be set. See How to use CDN with Webfonts for more details.

<object> placeholders work like <img> placeholders, with the added benefit of their DOM being able to be inspected and modified. As with <img> placeholders, the data-src attribute is more reliable than the data attribute.

Fluid placeholders

Important: Percentages are specified with the p character, not with the % character.

Specifying a dimension in percentages creates a fluid placeholder that responds to media queries.

<img data-src="holder.js/100px75?theme=social">

By default, the fluid placeholder will show its current size in pixels. To display the original dimensions, i.e. 100%x75, set the textmode flag to literal like so: holder.js/100px75?textmode=literal.

Automatically sized placeholders

If you'd like to avoid Holder enforcing an image size, use the auto flag like so:

<img data-src="holder.js/200x200?auto=yes">

The above will render a placeholder without any embedded CSS for height or width.

To show the current size of an automatically sized placeholder, set the textmode flag to exact like so: holder.js/200x200?auto=yes&textmode=exact.

Preventing updates on window resize

Both fluid placeholders and automatically sized placeholders in exact mode are updated when the window is resized. To set whether or not a particular image is updated on window resize, you can use the setResizeUpdate method like so:

var img = $('#placeholder').get(0);
Holder.setResizeUpdate(img, false);

The above will pause any render updates on the specified image (which must be a DOM object).

To enable updates again, run the following:

Holder.setResizeUpdate(img, true);

This will enable updates and immediately render the placeholder.

Background placeholders

Holder can render placeholders as background images for elements with the holderjs class, like this:

#sample {background:url(?holder.js/200x200?theme=social) no-repeat}
<div id="sample" class="holderjs"></div>

The Holder URL in CSS should have a ? in front. Like in image placeholders, you can specify the Holder URL in a data-background-src attribute:

<div class="holderjs" data-background-src="?holder.js/300x200"></div>

Important: Make sure to define a height and/or width for elements with background placeholders. Fluid background placeholders are not yet supported.

Runtime settings

Holder provides several options at runtime that affect the process of image generation. These are passed in through Holder.run calls.

  • domain: The domain to use for image generation. Default value: holder.js.
  • dataAttr: The HTML attribute used to define a fallback to the native src attribute. Default value: data-src.
  • renderer: The renderer to use. Options available: svg, canvas. Default value: svg.
  • images: The CSS selector used for finding img tags. Default value: img.
  • objects: The CSS selector used for finding object placeholders. Default value: object.
  • bgnodes: The CSS selector used for finding elements that have background palceholders. Default value: body .holderjs.
  • stylenodes: The CSS selector used for finding stylesheets to import into SVG placeholders. Default value: head link.holderjs.
  • noFontFallback: Do not fall back to canvas if using custom fonts.
  • noBackgroundSize: Do not set background-size for background placeholders.

Using custom settings on load

You can prevent Holder from running its default configuration by executing Holder.run with your custom settings right after including holder.js. However, you'll have to execute Holder.run again to render any placeholders that use the default configuration.

Using with lazyload.js

Holder is compatible with lazyload.js and works with both fluid and fixed-width images. For best results, run .lazyload({skip_invisible:false}).

Using with React

When using Holder in a React component, execute Holder.run in componentDidMount to enable rendering after state changes. See this issue for more details.

Using with Vue

You can use Holder in Vue 2+ projects with vue-holderjs.

Using with Angular.js

You can use Holder in Angular projects with ng-holder or with angular-2-holderjs for Angular 2 projects.

Using with Meteor

Because Meteor includes scripts at the top of the document by default, the DOM may not be fully available when Holder is called. For this reason, place Holder-related code in a "DOM ready" event listener.

Using with Webpack

If you're using ProvidePlugin in your Webpack config, make sure to configure it as follows:

plugins: [
  new webpack.ProvidePlugin({
    'Holder': 'holderjs',
    'holder': 'holderjs',
    'window.Holder': 'holderjs'
  })
]

Browser support

  • Chrome
  • Firefox 3+
  • Safari 4+
  • Internet Explorer 9+ (with partial support for 6-8)
  • Opera 12+
  • Android (with fallback)

Source

License

Holder is provided under the MIT License.

Credits

Holder is a project by Ivan Malopinsky.

holder's People

Contributors

alecharp avatar aogriffiths avatar bardware avatar bobundov avatar bradvin avatar collinanderson avatar cortys avatar cvrebert avatar davidbielik avatar edgardmessias avatar freezy-sk avatar hiddentao avatar ilmente avatar imcotton avatar imsky avatar johanneswuerbach avatar joshvillbrandt avatar jtanadi avatar kevinruscoe avatar lipis avatar lolychee avatar lukasdrgon avatar marclaporte avatar msealand avatar narkoz avatar ovax3 avatar rarst avatar rthrfrd avatar seriema avatar vbjay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

holder's Issues

Broken link icon when percent dimentions in non visible placeholders

Hello,

I apologize, Im verry new on github. I dont know where to put this message.

Every time I use holder.js in slide shows to render non visible placeholders with percent dimentions like: data-src="holder.js/100%x115/auto/dark/text:First slide",
it fails with a console message: Uncaught Error: Holder: placeholder is not visible

This is visible in Google Chrome (Windows, Linux and Android) and IE but not in Firefox.

I changed dimension_check() attempting to reach the closest visible parentElement, and try it to see how holder would render then.

Until now no more console message from Holder.

Changed of code:

function dimension_check(el, callback) {
    var dimensions = {
        height: el.clientHeight,
        width: el.clientWidth
    };
    if (!dimensions.height && !dimensions.width) {
        if (el.hasAttribute("data-holder-invisible")) {

// OLD:
            // throw new Error("Holder: placeholder is not visible");
// /OLD

// CHANGED:
            // FIXME: if options.offsetParent = true;
            // if (options.offsetParent) {
            if (true) {
                var e=el.parentElement;
                while(!e.offsetParent&&!(e.nodeName=="HTML")) e=e.parentElement;
                dimensions = {
                    height: e.clientHeight
                    ,width: e.clientWidth
                };
            };
            if(!!dimensions.height && !!dimensions.width){
                el.removeAttribute("data-holder-invisible");
            }else{
                throw new Error("Holder: placeholder is not visible");
            };
// /CHANGED

        } else {
            el.setAttribute("data-holder-invisible", true)
            setTimeout(function () {
                callback.call(this, el)
            }, 1)
            return null;
        }
    } else {
        el.removeAttribute("data-holder-invisible")
    }
    return dimensions;
}

Nice if it helps.

Thanks for this good job!

Nicolas.

Broken link icon with bootstrap carousel example

Hello,

There's a broken link icon on the second and third slide in carousel Bootstrap Example.
http://getbootstrap.com/examples/carousel/

The problem is visible in Google Chrome (Windows, Linux and Android) and IE but NOT in Firefox (Windows, Linux and Android).

I suppose (maybe i am wrong) that the problem concern holder.js but i am not sure because i just started learning Bootstrap...

Can you confirm ?

Thanks in advance. Olivier.

Running holder twice over the same image element

We have a specific need where I need to dynamically update the size of the picture according to a parameter.

The first time holder takes the holder URL from the data-src (as the src field is absent) field and values the src field with the image content.

The second time holder takes the holder URL from src field (as it is now valued) and does nothing because the image data doesn't match the expected holder URL pattern.

I think the problem comes from this line in the run method

var src = images[i].getAttribute("src") || images[i].getAttribute("data-src");

I'm not sure it is viable but a solution would be to test both field values against the pattern and take the first positive candidate.

Not working IE9, possibly below IE9 as well

I could be doing something really wrong here but I've created a simple test case and I'm unable to make the placeholder work in IE9. I get the system default image (image with red cross). I haven't tested below IE9.

If it is my mistake somewhere then please do let me know of any corrections I could make as i'm quite keen to implement this.

Use semver format for git tags

In order to be able to install holder from bower, the tags of the git repo should have a semver format.

From bower docs:

When tags are available in the endpoint, you can specify a semver tag to fetch concrete versions

Right now, it's impossible to install a concrete version of bower:

$ bower install holderjs#1.7.0
- holderjs Could not find tag satisfying: holderjs#1.7.0
The tag 1.7.0 could not be found within the repository
$ bower install holderjs#v1.7
- holderjs Could not find tag satisfying: holderjs#v1.7
The tag v1.7 could not be found within the repository

Accents break working

When letters with accents are used, the thumbnail is not generated.
<img data-src="holder.js/100%x180/sky/text:Árvíztűrő tükörfúrógép">

Use svg for rendering

Why canvas ? why not svg ? Creating svg would save CPU usage a lot ! An svg image for placeholder will be like 10 lines max. Then btoa can be used to encode it to base64 and then insert it in img.src.

Placeholders on Retina-displays

The computed image from "holder.js/200x120/" gets doubled in size (400x240) on retina-displays, which is good, because those displays have a devicePixelRatio of 2, but confusing if your viewport metatag property "width" and "height" are not set to "device-width" and "device-height" :).

This should either be documented or automatically scaled by 50% as described here:
http://stackoverflow.com/questions/7699621/display-image-at-50-of-its-native-size/7699686#7699686

Text is 0x0

Don't know if anyone has seen this bug yet, if not I can upload an example somewhere.

I'm using the Bootstrap example page with the carousel (which is where I found out about holder.js btw!), and using holder images in the carousel slides, only the holder images on the first slide displays the text (dimensions) correctly. The rest show 0x0 as the text (although the holders are the correct size), and the text isn't vertically centred, rather at the top of the placeholder.

Tried moving the js around from footer etc, doesn't seem to make a diff.
Thanks

image

background image 404?

I've got background images working fine using the method #sample {background:url(?holder.js/200x200/social) no-repeat}. However, the Chrome console throws the dreaded 404, even though to all appearances the page looks fine. I know this can be avoided for img tags by using data-src in place of src attribute. Is there any similar workaround to avoid the 404 on background images?

Can't install v2.0 via Bower

Bower 1.1.0 doesn't offer any version other than 1.9.0, even when installing via Git endpoint:

$ bower info https://github.com/imsky/holder.git
https://github.com/imsky/holder.git

  Versions:
    - 1.9.0

Possible cause is the project's inconsistent tagging scheme: every tag except this one is named vX.X.

holder.js makes jQuery's show() method no working in IE8

I have no idea what holder.js is doing in the core, but recently I had the problem that jQuery's show() method stops working in IE8 when passing any argument to it. After hours of debugging and researching it turned out, that this bug only appears when holder.js is included.

For me it felt pretty weird that holder.js influences jQuery's functionality in IE8, so I made a lot of tests. Unfortunately, there's nothing one can do.

So, is this a known bug?

Fluid placeholder text alignment

Custom text in a placeholder should always be centered vertically and horizontally. When creating a fluid placeholder with custom text, the text becomes top aligned.

This shows correctly:
<img data-src="holder.js/100%x400/">

This does not:
<img data-src="holder.js/100%x400/text:banners">

It looks the line-height is not being included, and extra margin is added on the top of the placeholder.

fluid images for responsive layouts

Any chance of using percentage measures instead of pixels? This is a very useful library but as it stands it usefulness on responsive layouts is diminished by the default pixel values written to the image width and height attributes. It would be great to control this via css thus we could use max-width 100% or similar.

Regards.

Remove background-color

While implementing Holder, I realized that it overrides any background-color set in my CSS. Here's a screenshot and the relevant CSS:

.img-polaroid {
  padding: 4px;
  background-color: #fff;
  border: 1px solid #ccc;
}

When used on a Holder image, the background-color is overwritten by the default theme. If I remove #L79, the problem is resolved and my CSS remains intact (note the white borders here given the padding and background I set in CSS).

Any reason the <img> gets a background color in addition to the image?

Work with jquery?

I have the following code

In the Html

<img src="holder.js/32x32/social/text:N">
<div id="img"></div>

In the javascript

$("#img").append("<img src=\"holder.js/32x32/social/text:N\">")

The static image if you build well. But that is generated dynamically with jquery, is generated as if there were

Sorry for my bad English

FR: allow specification of per-image class/id attributes

This would allow for testing further layout specifics.
Syntax could easily follow existing convention, eg:

<img src="holder.js/200x300/id:foo/class:bar baz" alt="" />

I was trying to hack this in quickly by reusing the custom text code, which is how I ran across the problem in issue #3, but whatever fix is applied there should ultimately be applicable to this case.

Font-family argument?

I'm sure font-family control would be useful to many others, but it's absence makes me think they're's some blocking issue. Can I hold out any hope for this?

Custom text doesn't work when dimensions set in %

Using v2.0 right now. Custom text doesn't work when dimensions are specified as %, i.e. this works:

<img data-src="holder.js/450x320/text:hello world">

but this doesn't:

<img data-src="holder.js/100%x100%/text:hello world">

The latter shows dimension instead of "hello world"

Dynamic page generation fail

My whole project using client-side page generation.
I cant get your system work with code like this(changed, because github markdown mess up with me):

$('body').append(' img data-src="holder.js/200x200" /');

Incorrect text when using percentage

For example:

<img data-src="holder.js/100%x90" alt="">

Text on placeholder is: {container size in px}x90. I'm sure it should be: 100%x90. Yes i know we can use:

<img data-src="holder.js/100%x90/text:100%x90">

But i'm sure this is incorrect default behavior.

Problem when [img] don't have a src

I'm having problem when one image have no src atributte (in my case, it happens in the facebook login button, probably because facebook adds the attribute/value dinamically).
in the line 216, i've added a check:

        if (src.indexOf(options.domain)>=0)

before the line condition:

if (src.indexOf(options.domain)>=0)

That line was trowing an "Uncaught TypeError: Cannot call method 'indexOf' of null"

The problem occurs on Chrome and Firefox (both on Mac). Strangely, don't affected Safari...

Probably there is a more elegant way of doing this, as I'm not a js expert.

Thanks,
Felipe

Problems with ie 7 & 8

Hi there,
Fist great prototyping plugin.Ivan Malopinsky Great job! & thanks for sharing
I am playing with it I found out that it doesn't render anything in IE 7, 8.
At the very bottom of the markdown I read about fallback for IE < 9. Is it the case that it doesn't work or i have to use some polyfill ?
I attached snapshots of the errors in IE 7 and 8. hope that helps

and that is my HTML:

<img src="holder.js/200x300"/>
<img src="holder.js/200x300/industrial">
<img src="holder.js/200x300/social">
<img src="holder.js/200x300/text:Hello World">

Hey thanks in advance !

Cheerz,
Guby

IE7
Win XP Pro IE7 Running

IE8
Win XP IE8

Image lazy loading (compatibility with lazyload.js)

It would be really cool if holder.js and lazyload.js worked together. The justification for this is that these two plugins have highly complementing roles in handling image loading.

The two main problems with making these two plugins compatible are:

  1. that lazyload only accepts properly specified src="/img/bg.png" or background-image=url("/img/bg.png") attributes. It can't handle the holder.js syntax/data-src.
  2. Responsive images (% instead of px) don't work since holder converts <img> tags with %width/height to <div>s thereby creating incompatibility with lazyload.

What are people's thoughts on image lazyloading?

IE8 compatibilty problem

Running holder.js in IE8 gives the following error:
'XMLSerializer' is undefined holder.js, line 154 character 2

MInimal example:

<html><head><script src="holder.js"></script></head><body>
<img data-src="holder.js/100x100">
</body></html>

The browser support says this: Internet Explorer 6+ (with fallback for older IE)

Text label that looks like dimensions is wrongly treated as such

If text label contains something that looks like dimensions script gets confused and uses that as dimensions to generate image.

Example: <img src="holder.js/300x200/text:3x2 ratio" />

  • expected - 300px x 200px image with "3x2 ratio" label
  • actual result - 3px x 2px image

Background

hi.
Is there anyway to use Holder in background-image?

Combining auto and fluid

It would be nice to be able to combine these two. For instance you might have an image inline with text on a large monitor but full-width on a small screen. Auto works fine for that since it doesn't add dimensions so we can target it with media queries. That said, it would be nice if it could still show the dimensions like it does in fluid mode. Is that a possibility? Thanks.

Add retina support

I'm implementing Holder into the Bootstrap docs right now to replace Placehold.it. Awesome work thus far—many thanks. One request I have though is adding retina support as right now images come out looking quite blurry.

Any chance a retina option can be added?

Custom text is not constrained to specific image

The custom text feature filters "down" to subsequent images in a document, rather than being limited to the one it was specified on, eg:

<img src="holder.js/200x200/text:foo" alt="" />
<img src="holder.js/200x200" alt="" />
<img src="holder.js/200x200" alt="" />
<img src="holder.js/200x200/text:bar" alt="" />

…results in three images captioned "foo" followed by the fourth with "bar.

Can currently be worked around by passing an empty text parameter to stop the propagation, eg:

<img src="holder.js/200x200/text:" alt="" />

Can't install specific versions via Bower

Running bower install holderjs#1.9.0 results in:

bower cloning git://github.com/imsky/holder.git
bower cached git://github.com/imsky/holder.git
bower fetching holderjs
bower error Could not find tag satisfying: holderjs#1.9.0

There where errors, here's a summary of them:
- holderjs Could not find tag satisfying: holderjs#1.9.0
The tag 1.9.0 could not be found within the repository

And bower info holderjs shows:

holderjs 

  Versions:
    - 54fcb722722c86274ece267850f08b9d775ad1a4
    - 

This might be because of the way you're labeling tags... But I'm not totally sure.

Automatic contrast

It would be nice if I could specify only a background color and have holder automatically pick a contrasting colour for the text overlay. The contrast function in LESS.js does this according to the WCAG spec. It would require a regex to match a single colour instead of the pair that you currently match in the app.flags object.

License notice mismatch

I see that the README.md and package.json was recently changed to say that holder was released under the MIT License, but the holder.js and holder.min.js files in the gate still claim it's under the Apache license.

Replace original image with dynamic size

I have an original holder image holder.js/180x180

How to replace it with new image with dynamic height in js ? I tried..

Holder.run({
images: '#src',
src: someimage.jpg
});

OR

Holder.add_image('#src', someimage.jpg).run()

The replaced image should have height more than 180 from default placeholder image.

Maintain aspect ratio of fluid images?

I may have missed something, but as it currently stands fluid images will shrink horizontally but always maintain the original height. I'd like the image to maintain its aspect ratio as it shrinks, so the height should decrease as the width decreases.

Is this possible?

Use holder.js to prevent 404

Hi,

thanks for your work. Does it exist a way to use holder.js to replace images that are 404?
I tryied using the $('img').error() from jquery, and change the attr src ou src-data and it didn't work. Perhaps it exists a method implemented in holder.js ?

Angularjs support?

Would be great if I could use this neat little tool with angularjs.
Unfortunately, all content is generated on the fly with Angularjs, so holder doesn't register itself on newly inserted content.

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.