Load script defined as attribute [data-load-script]
as element becomes in view
- Source:
Properties:
Name | Type | Description |
---|---|---|
selector |
string | targets elements on to set up dynamic loading |
hiddenCss |
string | CSS class that hides an element |
loadingCss |
string | CSS class that displays a loading state |
Example
<div data-load-script="url" data-placeholder=".c-module__placeholder">
<div class="c-module__placeholder"></div>
</div>
Methods
(inner) broadcastLoad()
- Source:
Fire a custom event signifying script being loaded
(inner) init()
- Source:
Set's up InView
listener on any [data-load-content]
elements.
Callback is fired when element comes into view.
(inner) load()
- Source:
Load script specified by [data-load-script]
.
Inserts script before first script tag on the page