coonlink-luxy 26.1.3 → 26.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# coonlink-luxy
|
|
2
|
+
|
|
3
|
+
Inertia scroll and parallax (same idea as [luxy.js](https://github.com/min30327/luxy.js)), with fixes for modern browsers, `data-speed-y`, and clean `destroy()` for React/Next.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i coonlink-luxy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Markup
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<div id="luxy">
|
|
15
|
+
<div class="luxy-el" data-speed-y="5" data-offset="-50">…</div>
|
|
16
|
+
</div>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`#luxy` gets a CSS `transform` while scrolling. Any child with `position: fixed` would be positioned against that transformed box, not the browser viewport — so pin overlays (modals, toasts, QR widgets) with a **React portal to `document.body`** (or keep them outside `#luxy`).
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createCoonlinkLuxy } from 'coonlink-luxy'
|
|
25
|
+
|
|
26
|
+
const luxy = createCoonlinkLuxy()
|
|
27
|
+
luxy.init({
|
|
28
|
+
wrapper: '#luxy',
|
|
29
|
+
targets: '.luxy-el',
|
|
30
|
+
wrapperSpeed: 0.08,
|
|
31
|
+
targetSpeed: 0.02,
|
|
32
|
+
targetPercentage: 0.1,
|
|
33
|
+
respectReducedMotion: true,
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
// SPA / React unmount:
|
|
37
|
+
luxy.destroy()
|
|
38
|
+
```
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAC7C,OAAO,IAAI,IAAI,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAC7C,OAAO,IAAI,IAAI,CAAC;CACjB;AA8ND,wBAAgB,kBAAkB,IAAI,oBAAoB,CAEzD;AAED,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAEjF"}
|
package/dist/index.js
CHANGED
|
@@ -96,6 +96,8 @@ class Engine {
|
|
|
96
96
|
for (let i = 0; i < this.targets.length; i++)
|
|
97
97
|
this.targetsUpdate(this.targets[i]);
|
|
98
98
|
if (this.isSettled()) {
|
|
99
|
+
this.wrapperOffset = this.scrollTop;
|
|
100
|
+
this.wrapperUpdate();
|
|
99
101
|
this.scrollRaf = 0;
|
|
100
102
|
window.addEventListener('scroll', this.onScrollResume, { passive: true });
|
|
101
103
|
return;
|
package/package.json
CHANGED