@@ -49,31 +49,51 @@ this.scroll = new modularScroll({
4949``` js
5050import modularScroll from ' modularscroll' ;
5151
52- this .scroll = new modularScroll ({} );
52+ this .scroll = new modularScroll ();
5353
5454this .scroll .update ();
5555```
5656
57+ #### With events
58+ ``` js
59+ import modularScroll from ' modularscroll' ;
60+
61+ this .scroll = new modularScroll ();
62+
63+ this .scroll .on (' call' , (func ) => {
64+ this .call (... func); // Using modularJS
65+ });
66+ ```
67+ ``` html
68+ <div data-scroll data-scroll-call =" function, module" >Trigger</div >
69+ ```
70+
5771## Options
5872| Option | Type | Default | Description |
5973| ------ | ---- | ------- | ----------- |
60- | ` el ` | ` object ` | ` document ` | Scroll container element |
61- | ` name ` | ` string ` | ` 'scroll' ` | Data attributes name |
62- | ` class ` | ` string ` | ` 'is-inview' ` | Elements in-view class |
63- | ` offset ` | ` number ` | ` 0 ` | In-view trigger offset |
64- | ` repeat ` | ` boolean ` | ` false ` | Repeat in-view detection |
74+ | ` el ` | ` object ` | ` document ` | Scroll container element. |
75+ | ` name ` | ` string ` | ` 'scroll' ` | Data attributes name. |
76+ | ` class ` | ` string ` | ` 'is-inview' ` | Elements in-view class. |
77+ | ` offset ` | ` number ` | ` 0 ` | In-view trigger offset. |
78+ | ` repeat ` | ` boolean ` | ` false ` | Repeat in-view detection. |
6579
6680## Attributes
6781| Attribute | Values | Description |
6882| --------- | ------ | ----------- |
69- | ` data-scroll ` | | Detect if in-view |
70- | ` data-scroll-class ` | ` string ` | Element in-view class |
71- | ` data-scroll-offset ` | ` number ` | Element in-view trigger offset |
72- | ` data-scroll-repeat ` | ` true ` , ` false ` | Element in-view detection repeat |
83+ | ` data-scroll ` | | Detect if in-view. |
84+ | ` data-scroll-class ` | ` string ` | Element in-view class. |
85+ | ` data-scroll-offset ` | ` number ` | Element in-view trigger offset. |
86+ | ` data-scroll-repeat ` | ` true ` , ` false ` | Element in-view detection repeat. |
87+ | ` data-scroll-call ` | ` string ` | Element in-view trigger call event. |
7388
7489## Methods
7590| Method | Description |
7691| --------- | ----------- |
77- | ` init() ` | Reinit the scroll |
78- | ` update() ` | Update elements position |
79- | ` destroy() ` | Destroy the scroll events |
92+ | ` init() ` | Reinit the scroll. |
93+ | ` update() ` | Update elements position. |
94+ | ` destroy() ` | Destroy the scroll events. |
95+
96+ ## Events
97+ | Event | Arguments | Description |
98+ | ----- | --------- | ----------- |
99+ | ` call ` | ` func ` | Trigger if in-view. Returns your ` string ` or ` array ` if contains ` , ` . |
0 commit comments