Skip to content

Commit 8c95208

Browse files
author
alexander.farkas
committed
3.0.0-rc1
1 parent 96f5b0c commit 8c95208

27 files changed

+34
-31
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
},
8484
minified: {
8585
options: {
86-
maxBytes: (1024 * 6.333)
86+
maxBytes: (1024 * 6.433)
8787
},
8888
src: ["lazysizes.min.js"]
8989
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ window.lazySizesConfig = window.lazySizesConfig || {};
323323
window.lazySizesConfig.customMedia = {
324324
'--small': '(max-width: 480px)',
325325
'--medium': '(max-width: 900px)',
326-
'--large': '(max-width: 1400px)'
326+
'--large': '(max-width: 1400px)',
327327
};
328328
</script>
329329

@@ -352,7 +352,7 @@ window.lazySizesConfig.customMedia = {
352352
* ``lazySizesConfig.expFactor`` (default: ``1.5``): The ``expFactor`` is used to calculate the "preload expand", by multiplying the normal ``expand`` with the ``expFactor`` which is used to preload assets while the browser is idling (no important network traffic and no scrolling). (Reasonable values are between ``1.5`` and ``4`` depending on the ``expand`` option).
353353
* ``lazySizesConfig.hFac`` (default: ``0.8``): The ``hFac`` (horizontal factor) modifies the horizontal expand by multiplying the ``expand`` value with the ``hFac`` value. Use case: In case of carousels there is often the wish to make the horizontal expand narrower than the normal vertical expand option. Reasonable values are between 0.4 - 1. In the unlikely case of a horizontal scrolling website also 1 - 1.5.
354354
* ``lazySizesConfig.loadMode`` (default: ``2``): The ``loadMode`` can be used to constrain the allowed loading mode. Possible values are 0 = don't load anything, 1 = only load visible elements, 2 = load also very near view elements (``expand`` option) and 3 = load also not so near view elements (``expand`` * ``expFactor`` option). This value is automatically set to ``3`` after onload. Change this value to ``1`` if you (also) optimize for the onload event or change it to ``3`` if your onload event is already heavily delayed.
355-
* ``lazySizesConfig.init`` (default: ``true``): By default lazysizes initializes itself as soon as possible, to load in view assets as soon as possible. In the unlikely case you need to setup/configure something with a later script you can set this option to ``false`` and call ``lazySizes.init();`` later explicitly.
355+
* ``lazySizesConfig.init`` (default: ``true``): By default lazysizes initializes itself, to load in view assets as soon as possible. In the unlikely case you need to setup/configure something with a later script you can set this option to ``false`` and call ``lazySizes.init();`` later explicitly.
356356

357357
####JS API - events
358358
**lazysizes** provides two events to modify or extend the behavior of **lazysizes**.
@@ -439,7 +439,7 @@ Tests whether new elements has came into view. Normally this method only needs t
439439

440440
#####``lazySizes.init()``
441441

442-
LazySizes initializes itself automatically as soon as possible. In case you set ``lazySizesConfig.init`` to ``false`` you need to explicitly call ``lazySizes.init()``.
442+
LazySizes initializes itself automatically. In case you set ``lazySizesConfig.init`` to ``false`` you need to explicitly call ``lazySizes.init()``. Note: You can speed up initial loading of in view images if you call `lazySizesConfig.init()` explicitly after lazysizes and all plugins are loaded.
443443

444444
```html
445445
<script>
@@ -683,7 +683,7 @@ While lazy loading is a great feature, it is important for users that crucial in
683683

684684
In case you normally combine all your scripts into one large script and add this to the bottom of your page, it can be better for perceived performance to generate two or sometimes more script packages: One small package, which includes all scripts which have heavy influence on the content or the UI and another larger one which includes the normal behavior of the page.
685685

686-
This smaller script, which should include lazySizes, should than be placed **before** any other blocking elements (i.e.: script(s)) at the end of the body or after any blocking elements (i.e.: scripts, stylesheets) in the head to load the crucial content as fast possible.
686+
This smaller script, which should include lazySizes (and all its plugins), should than be placed **before** any other blocking elements (i.e.: script(s)) at the end of the body or after any blocking elements (i.e.: scripts, stylesheets) in the head to load the crucial content as fast possible. (Note: It might make also sense to call `lazySizes.init();` explicitly right after lazySizes and all its plugins are added.)
687687

688688
##Why lazysizes
689689
In the past I often struggled using lazy image loaders, because the "main check function" is called repeatedly and with a high frequency. Which makes it hard to fulfill two purposes runtime and memory efficiency. And looking into the source code of most so called lazy loaders often also unveils lazy developers...

lazysizes-umd.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@
547547

548548
if(lazyloadElems.length){
549549
checkElements();
550+
rAF._lsFlush();
550551
} else {
551552
throttledCheckElements();
552553
}

lazysizes-umd.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazysizes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@
545545

546546
if(lazyloadElems.length){
547547
checkElements();
548+
rAF._lsFlush();
548549
} else {
549550
throttledCheckElements();
550551
}

0 commit comments

Comments
 (0)