Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md . #877

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,22 @@ lazysizes adds the class ``lazyloading`` while the images are loading and the cl

In case you are using an `alt` attribute but do not declare a `src`/`srcset` attribute you will end up with a broken image symbol.

There are two easy ways to deal with it.
There are easy ways to deal with it.

Either define a `src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="` or add the following CSS.

```css
img.lazyload:not([src]) {
img.lazyloaded:not([src]) {
visibility: hidden;
}
```

```css
img.lazyloaded:not([src]) {
background-size: cover;
background-image: url("default.png");
background-color: lightskyblue;
}
```

### JS API
**lazysizes** automatically detects new elements with the class ``lazyload`` so you won't need to call or configure anything in most situations.
Expand Down