Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aFarkas committed Apr 28, 2019
1 parent 0bc242e commit 2f2e426
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ img.lazyload:not([src]) {
**lazysizes** automatically detects new elements with the class ``lazyload`` so you won't need to call or configure anything in most situations.

#### JS API - options

Options can be set by declaring a global configuration option object named ``lazySizesConfig``. This object must be defined before the lazysizes script. A basic example:

```js
Expand All @@ -328,6 +329,15 @@ lazySizesConfig.srcAttr = 'data-original';
lazySizesConfig.loadMode = 1;
```

In case you are using a module bundler it is recommended to change the options directly after importing the `lazysizes` module:

```js
import lazySizes from 'lazysizes';
// other imports ...

lazySizes.cfg.lazyClass = 'lazy';
```

Here the list of options:

* ``lazySizesConfig.lazyClass`` (default: ``"lazyload"``): Marker class for all elements which should be lazy loaded (There can be only one ``class``. In case you need to add some other element, without the defined class, simply add it per JS: ``$('.lazy-others').addClass('lazyload');``)
Expand Down
2 changes: 1 addition & 1 deletion plugins/blur-up/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The new image (`ls-blur-up-img`) will get the following state classes to enable
padding-bottom: 66.6667%;
}
.lazyload:not([src]) {
img.lazyload:not([src]) {
visibility: hidden;
}
Expand Down

0 comments on commit 2f2e426

Please sign in to comment.