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
feat: upgrade to version 1.2.0 with new features and improvements
- Added support for resolving target elements from string selectors.
- Introduced a new function to convert anchor links for smooth scrolling.
- Enhanced option reading and parsing for better flexibility.
- Improved event listeners for scroll actions, including keyboard accessibility.
- Updated documentation and comments for clarity.
- Minor optimizations and code cleanup for better maintainability.
|`rt-smooth-scroll-lock`| Lock scroll during animation |
201
+
|`rt-smooth-scroll-force`| Force scroll even if stopped |
202
+
|`rt-smooth-scroll-target-id`|**Explicitly** target a specific scroll instance ID (e.g. "panel") |
203
+
204
+
### Dynamic Element Offsets
205
+
206
+
Instead of hardcoding pixels, you can pass a selector to `rt-smooth-scroll-offset`. The library will calculate that element's `offsetHeight` and apply it as a **negative offset** (perfect for sticky headers).
You can automatically convert standard `<a>` tags (e.g., `<a href="#contact">`) into smooth scroll triggers without manually adding attributes to every link.
219
+
220
+
### Enable Conversion
221
+
222
+
Add this attribute to your `<body>` or `<html>` tag:
`rt-smooth-scroll` supports any number of independent Lenis instances on a page. Each instance has its own wrapper + content and can be controlled individually via API.
189
240
241
+
**Context Awareness:**
242
+
If a `rt-smooth-scroll-to` button is placed **inside** a nested scroll instance, it will automatically control that parent instance, not the root window, unless you explicitly override it with `rt-smooth-scroll-target-id`.
|`refreshAnchors()`| Manually re-run anchor link conversion (useful for dynamic content) |
265
+
|`destroy(id?)`| Remove instance |
211
266
212
267
**Default root Lenis instance** is also exposed as:
213
268
@@ -217,7 +272,7 @@ window.lenis;
217
272
218
273
---
219
274
220
-
## 7. Console Logging
275
+
## 9. Console Logging
221
276
222
277
On startup, each instance logs:
223
278
@@ -230,7 +285,7 @@ This helps you confirm exactly what configuration is applied in the browser.
230
285
231
286
---
232
287
233
-
## 8. Troubleshooting
288
+
## 10. Troubleshooting
234
289
235
290
### Scroll feels laggy / too delayed
236
291
@@ -242,27 +297,18 @@ This helps you confirm exactly what configuration is applied in the browser.
242
297
243
298
Lenis treats `duration` and `easing` as **useless if `lerp` is defined**. If you want time-based behavior, ensure you’re not effectively running in lerp-mode.
244
299
245
-
### Instance not initialized
246
-
247
-
Ensure you’ve enabled either:
248
-
249
-
- the root attribute (`rt-smooth-scroll`), or
250
-
- one or more instance elements.
251
-
252
-
### Lenis fails to load
253
-
254
-
If using a custom `rt-smooth-scroll-lenis-src`, confirm the URL points to a valid Lenis build.
0 commit comments