Skip to content

Commit

Permalink
Merge branch 'release/17.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Verlicchi committed Jul 1, 2020
2 parents 1aa5151 + 18fb5d3 commit 9b7521a
Show file tree
Hide file tree
Showing 46 changed files with 7,674 additions and 7,134 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Version 17

#### 17.1.0

- Unobserve all elements on `loadAll()` call. It's better for performance, and it solves #469.
- Added some hidden images in the `load_all.html` demo

#### 17.0.1

- Bug fix: `callback_exit()` was not being called on non-image elements (#468).
Expand Down
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Please note that the video poster can be lazily loaded too.

## 👩‍💻 Getting started - Script

The latest, recommended version of LazyLoad is **17.0.1**.
The latest, recommended version of LazyLoad is **17.1.0**.

Quickly understand how to upgrade from a previous version reading the [practical upgrade guide](UPGRADE.md).

Expand All @@ -196,14 +196,14 @@ If you prefer to load a polyfill, the regular LazyLoad behaviour is granted.
The easiest way to use LazyLoad is to include the script from a CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.0.1/dist/lazyload.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.0/dist/lazyload.min.js"></script>
```

Or, with the IntersectionObserver polyfill:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected]/intersection-observer.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.0.1/dist/lazyload.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.0/dist/lazyload.min.js"></script>
```

Then, in your javascript code:
Expand Down Expand Up @@ -235,7 +235,7 @@ Include RequireJS:
Then `require` the AMD version of LazyLoad, like this:

```js
var lazyLoadAmdUrl = "https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.0.1/dist/lazyload.amd.min.js";
var lazyLoadAmdUrl = "https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.0/dist/lazyload.amd.min.js";
var polyfillAmdUrl = "https://cdn.jsdelivr.net/npm/[email protected]/intersection-observer-amd.js";

/// Dynamically define the dependencies
Expand Down Expand Up @@ -280,7 +280,7 @@ Then include the script.
```html
<script
async
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.0.1/dist/lazyload.min.js"
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.0/dist/lazyload.min.js"
></script>
```
Expand Down Expand Up @@ -314,7 +314,7 @@ Then include the script.
```html
<script
async
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.0.1/dist/lazyload.min.js"
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.0/dist/lazyload.min.js"
></script>
```
Expand All @@ -326,12 +326,10 @@ lazyLoadInstance.update();
Note about Internet Explorer: because this technique uses a `CustomEvent` to trigger the `LazyLoad::Initialized` event, you might want to add [this polyfill](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill) to make it work on Internet Explorer.
[DEMO](https://www.andreaverlicchi.eu/vanilla-lazyload/demos/async.html) - [SOURCE](https://github.com/verlok/vanilla-lazyload/blob/master/demos/async.html) &larr; for a single LazyLoad instance
[DEMO](https://www.andreaverlicchi.eu/vanilla-lazyload/demos/async_multiple.html) - [SOURCE](https://github.com/verlok/vanilla-lazyload/blob/master/demos/async_multiple.html) &larr; for multiple LazyLoad instances
### Local install
If you prefer to install LazyLoad locally in your project, you can!
Expand Down Expand Up @@ -803,11 +801,11 @@ Here's the list of the options.
You can call the following methods on any instance of LazyLoad.
| Method name | Effect | Use case |
| ----------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `update()` | Make LazyLoad to re-check the DOM for `elements_selector` elements inside its `container`. | Update LazyLoad after you added or removed DOM elements to the page. |
| `loadAll()` | Loads all the lazy images right away, no matter if they are inside or outside the viewport. | To load all the remaining elements in advance |
| `destroy()` | Destroys the instance, unsetting instance variables and removing listeners. | Free up some memory. Especially useful for Single Page Applications. |
| Method name | Effect | Use case |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `update()` | Make LazyLoad to re-check the DOM for `elements_selector` elements inside its `container`. | Update LazyLoad after you added or removed DOM elements to the page. |
| `loadAll()` | Loads all the lazy elements right away _and_ stop observing them, no matter if they are inside or outside the viewport, no matter if they are hidden or visible. | To load all the remaining elements in advance |
| `destroy()` | Destroys the instance, unsetting instance variables and removing listeners. | Free up some memory. Especially useful for Single Page Applications. |
**Static methods**
Expand Down
5 changes: 4 additions & 1 deletion currentFeature.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Current feature:
# Current feature:

- Unobserve all elements on `loadAll()`. It's better for performance. It solves #469.
- Added some hidden images in the `load_all.html` demo
Loading

0 comments on commit 9b7521a

Please sign in to comment.