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
@@ -34,27 +35,30 @@ The source code is entirely written in [standard ECMAScript](https://tc39.es/) w
34
35
All major budle formats are supported, including [umd](https://github.com/umdjs/umd), [iife](https://developer.mozilla.org/en-US/docs/Glossary/IIFE), [amd](https://en.wikipedia.org/wiki/Asynchronous_module_definition), [cjs](https://en.wikipedia.org/wiki/CommonJS), [esm](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) and [SystemJS](https://github.com/systemjs/systemjs); also, a minified version and a transpiled version through babel are available for each of those.
At this point, the lock state can be changed simply **toggling that CSS class**; since the CSS class change is internally observed, the class change itself can be done through native DOM API, a virtual DOM library, another DOM manipulation script, etc...
This is the complete list of CSS variables set by this library on the given elements.
139
147
140
-
*`--scroll-padlock-scroll-top`: the number of pixels that the target is scrolled vertically.
141
-
*`--scroll-padlock-scroll-left`: the number of pixels that the target is scrolled horizontally.
142
-
*`--scroll-padlock-scrollbar-width`: the target's vertical scrollbar size.
143
-
*`--scroll-padlock-scrollbar-height`: the target's horizontal scrollbar size.
144
-
*`--scroll-padlock-outer-width`: the target's width including the scrollbar size.
145
-
*`--scroll-padlock-outer-height`: the target's height including the scrollbar size.
146
-
*`--scroll-padlock-inner-width`: the target's width without the scrollbar size.
147
-
*`--scroll-padlock-inner-height`: the target's height without the scrollbar size.
148
-
*`--scroll-padlock-scroll-width`: the target's content width.
149
-
*`--scroll-padlock-scroll-height`: the target's content height.
148
+
-`--scroll-padlock-scroll-top`: the number of pixels that the target is scrolled vertically.
149
+
-`--scroll-padlock-scroll-left`: the number of pixels that the target is scrolled horizontally.
150
+
-`--scroll-padlock-scrollbar-width`: the target's vertical scrollbar size.
151
+
-`--scroll-padlock-scrollbar-height`: the target's horizontal scrollbar size.
152
+
-`--scroll-padlock-outer-width`: the target's width including the scrollbar size.
153
+
-`--scroll-padlock-outer-height`: the target's height including the scrollbar size.
154
+
-`--scroll-padlock-inner-width`: the target's width without the scrollbar size.
155
+
-`--scroll-padlock-inner-height`: the target's height without the scrollbar size.
156
+
-`--scroll-padlock-scroll-width`: the target's content width.
157
+
-`--scroll-padlock-scroll-height`: the target's content height.
150
158
151
159
## API
152
160
@@ -174,21 +182,21 @@ instance.scroll = { top, left };
174
182
175
183
// Gets the current instance element layout sizes
176
184
const {
177
-
// The target's width and height including the scrollbar size
178
-
outerWidth,
179
-
outerHeight,
185
+
// The target's width and height including the scrollbar size
186
+
outerWidth,
187
+
outerHeight,
180
188
181
-
// The target's width and height without the scrollbar size
182
-
innerWidth,
183
-
innerHeight,
189
+
// The target's width and height without the scrollbar size
190
+
innerWidth,
191
+
innerHeight,
184
192
185
-
// The target's content width and height
186
-
scrollWidth,
187
-
scrollHeight,
193
+
// The target's content width and height
194
+
scrollWidth,
195
+
scrollHeight,
188
196
189
-
// The target's vertical and horizontal scrollbar size
190
-
scrollbarWidth,
191
-
scrollbarHeight
197
+
// The target's vertical and horizontal scrollbar size
198
+
scrollbarWidth,
199
+
scrollbarHeight,
192
200
} =instanse.layout;
193
201
```
194
202
@@ -212,20 +220,20 @@ If positioned elements "jumps" on a parent lock state change, the same CSS varia
212
220
```css
213
221
/* A right-positioned child */
214
222
.positioned-element {
215
-
position: fixed;
216
-
right: 0;
223
+
position: fixed;
224
+
right: 0;
217
225
}
218
226
219
227
/* The same right-positioned element, */
220
228
/* not affected by its own container scrollbars disappearance */
221
229
.your-locked-class.positioned-element {
222
-
right: var(--scroll-padlock-scrollbar-width);
230
+
right: var(--scroll-padlock-scrollbar-width);
223
231
}
224
232
```
225
233
226
234
## iOS Bars and Keyboard Tray
227
235
228
-
There might still be an iOS edge case when locking body scroll with _position: fixed_ technique.
236
+
There might still be an iOS edge case when locking body scroll with _position: fixed_ technique.
229
237
230
238
When the page is scrolled the **system bars** become smaller; at that point, when focusing an input element programmatically, the keyboard tray is triggered and the bars become larger again; that, probably when some animations are taking place, can cause the following visual artifacts.
0 commit comments