You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To save an HTTP request, you can even inline the entire Defer.js library by copying its content from the [defer.min.js](https://cdn.jsdelivr.net/npm/@shinsenter/defer.js@3.6.0/dist/defer.min.js) and replacing the comments in the script tag with its content.
106
+
To save an HTTP request, you can even inline the entire Defer.js library by copying its content from the [defer.min.js](https://cdn.jsdelivr.net/npm/@shinsenter/defer.js@3.7.0/dist/defer.min.js) and replacing the comments in the script tag with its content.
107
107
108
108
```html
109
109
<head>
@@ -127,7 +127,7 @@ If you're using an older version of Defer.js, you can use `defer_plus.min.js` in
*NOTE*: Modern browsers support the `IntersectionObserver` feature, so you don't have to worry about adding the polyfill if you don't have legacy browsers in mind.
@@ -154,8 +154,8 @@ To enhance performance for legacy browsers that don't support the `IntersectionO
@@ -181,7 +181,7 @@ Wrapping your script with `Defer()` may help your website prevent render-blockin
181
181
| Param | Type | Default | Description |
182
182
| --- | --- | --- | --- |
183
183
| func | <code>function</code> || A function to be executed after page fully loaded. |
184
-
|[delay]| <code>number</code> | <code>0</code> |The time, in milliseconds that it should wait before the function is executed. |
184
+
|[delay]| <code>number</code> | <code>0</code> |A timespan, in milliseconds, that the page should wait before the function is executed. |
185
185
|[waitForUserAction]| <code>boolean</code> | <code>false</code> | This argument tells `Defer()` to delay the execution and wait until there is a user interaction. |
186
186
187
187
**Example**
@@ -214,7 +214,7 @@ and wait until the user starts interacting with your page.
@@ -305,7 +305,7 @@ View the discussion [#122](https://code.shin.company/defer.js/discussions/122) f
305
305
| Param | Type | Default | Description |
306
306
| --- | --- | --- | --- |
307
307
|[selector]| <code>string</code> | <code>"[type=deferjs]"</code> | A CSS selector selects target script tags that will be Lazy loaded. |
308
-
|[delay]| <code>number</code> | <code>0</code> |The time, in milliseconds that it should wait before a script tag is executed. |
308
+
|[delay]| <code>number</code> | <code>0</code> |A timespan, in milliseconds, that the page should wait before a script tag is executed. |
309
309
|[waitForUserAction]| <code>boolean</code> | <code>false</code> | This argument tells the `Defer.all()` method to delay the execution of scripts until there is a user interaction. |
310
310
311
311
**Example**
@@ -409,7 +409,7 @@ Please check out the below examples for more details.
409
409
| Param | Type | Default | Description |
410
410
| --- | --- | --- | --- |
411
411
|[selector]| <code>string</code> | <code>"[data-src]"</code> | A CSS selector selects target HTML elements that will be unveiled later. |
412
-
|[delay]| <code>number</code> | <code>0</code> |The time, in milliseconds that it should wait before lazy loading is applied for target elements. |
412
+
|[delay]| <code>number</code> | <code>0</code> |A timespan, in milliseconds, that the page should wait before lazy loading is applied for target elements. |
413
413
|[unveiledClass]| <code>string</code> || Class names that will be added to target elements when they are unveiled. |
414
414
|[resolver]|[<code>NodeHandler</code>](#NodeHandler)|| A [NodeHandler](#NodeHandler) will check a [Node](#Node) to determine if it will be unveiled or not. If the `resolver()` callback returns `false`, the node will not be unveiled. |
of external CSS files without blocking the page rendering.
709
709
@@ -715,10 +715,10 @@ The `fileUrl` will not be fetched unless the user starts interacting with your p
715
715
716
716
| Param | Type | Default | Description |
717
717
| --- | --- | --- | --- |
718
-
| fileUrl | <code>string</code> || URL to the CSS file that should be lazy loaded. |
719
-
|[id]| <code>string</code> ||The ID will be assigned to the script tag to avoid downloading the same file multiple times. |
720
-
|[delay]| <code>number</code> | <code>0</code> |The time, in milliseconds that the page should wait before the CSS file is fetched. |
721
-
|[onload]| <code>function</code> ||The callback function will be executed if the CSS file is successfully loaded. |
718
+
| fileUrl | <code>string</code> ||The URL to the CSS file that should be lazy loaded. |
719
+
|[id_or_attributes]| <code>string</code> \| <code>object</code>|| An ID string or an attribute object for the link tag that should be added to the page. |
720
+
|[delay]| <code>number</code> | <code>0</code> |A timespan, in milliseconds, that the page should wait before the CSS file is fetched. |
721
+
|[onload]| <code>function</code> ||A callback function will be executed if the CSS file is successfully loaded. |
722
722
|[waitForUserAction]| <code>boolean</code> | <code>false</code> | This argument tells the `Defer.css()` method to delay downloading the CSS file until there is a user interaction. |
723
723
724
724
**Example**
@@ -741,7 +741,7 @@ Using the `Defer.css()` method to lazy load
741
741
<script>
742
742
var fileUrl ='https://pro.fontawesome.com/releases/v5.14.0/css/all.css';
We use the `Defer.js()` method to defer a load of 3rd-party
783
784
JavaScript libraries, widgets, add-ons, etc. without blocking the page rendering.
784
785
@@ -794,10 +795,10 @@ The `fileUrl` will not be fetched unless the user starts interacting with your p
794
795
795
796
| Param | Type | Default | Description |
796
797
| --- | --- | --- | --- |
797
-
| fileUrl | <code>string</code> || URL to the js file that should be lazy loaded. |
798
-
|[id]| <code>string</code> ||The ID will be assigned to the script tag to avoid downloading the same file multiple times. |
799
-
|[delay]| <code>number</code> | <code>0</code> |The time, in milliseconds that the page should wait before the JS file is fetched. |
800
-
|[onload]| <code>function</code> ||The callback function will be executed if the js file is successfully loaded. |
798
+
| fileUrl | <code>string</code> ||The URL to the js file that should be lazy loaded. |
799
+
|[id_or_attributes]| <code>string</code> \| <code>object</code>|| An ID string or an attribute object for the script tag that should be added to the page. |
800
+
|[delay]| <code>number</code> | <code>0</code> |A timespan, in milliseconds, that the page should wait before the JS file is fetched. |
801
+
|[onload]| <code>function</code> ||A callback function will be executed if the js file is successfully loaded. |
801
802
|[waitForUserAction]| <code>boolean</code> | <code>false</code> | This argument tells the `Defer.js()` method to delay downloading the JS file until there is a user interaction. |
802
803
803
804
**Example**
@@ -815,34 +816,12 @@ so the `waitForUserAction` argument (the fifth argument) is set to `false`.
0 commit comments