@madj2k/fe-frontend-kit 2.0.22 → 2.0.24
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.
|
@@ -234,6 +234,7 @@ class Madj2kFlyoutMenu {
|
|
|
234
234
|
if (!$menu.classList.contains(openStatusClass) && !$menu.classList.contains(animationOpenStatusClass)) {
|
|
235
235
|
document.dispatchEvent(new CustomEvent('madj2k-slidemenu-close'));
|
|
236
236
|
document.dispatchEvent(new CustomEvent('madj2k-pulldownmenu-close'));
|
|
237
|
+
document.dispatchEvent(new CustomEvent('madj2k-flyoutmenu-close'));
|
|
237
238
|
document.dispatchEvent(new CustomEvent('madj2k-flyoutmenu-opening'));
|
|
238
239
|
|
|
239
240
|
this.toggleNoScroll();
|
|
@@ -371,15 +372,17 @@ class Madj2kFlyoutMenu {
|
|
|
371
372
|
* Adjusts menu padding based on settings
|
|
372
373
|
*/
|
|
373
374
|
paddingMenu() {
|
|
375
|
+
|
|
374
376
|
if (!this.settings.$paddingReference) return;
|
|
375
377
|
if (this.settings.paddingBehavior === 0) return;
|
|
376
|
-
|
|
378
|
+
// should be re-evaluated on a resize event after re-opening the menu
|
|
379
|
+
// if (this.settings.paddingBehavior === 1 && this.settings.$menuInner.hasAttribute('data-padding-set')) return;
|
|
377
380
|
|
|
378
381
|
let left = this.settings.$paddingReference.getBoundingClientRect().left;
|
|
379
382
|
if (window.innerWidth < this.settings.paddingViewPortMinWidth) left = 0;
|
|
380
383
|
|
|
381
384
|
this.settings.$menuInner.style.paddingLeft = `${left}px`;
|
|
382
|
-
this.settings.$menuInner.setAttribute('data-padding-set', 'true');
|
|
385
|
+
// this.settings.$menuInner.setAttribute('data-padding-set', 'true');
|
|
383
386
|
}
|
|
384
387
|
|
|
385
388
|
/**
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# @madj2k/frontend-kit
|
|
1
|
+
# @madj2k/fe-frontend-kit
|
|
2
2
|
Reusable frontend toolkit including SCSS mixins and menu components (JS/SCSS).
|
|
3
3
|
|
|
4
4
|
# # Installation
|
|
5
5
|
```
|
|
6
|
-
npm install @madj2k/frontend-kit
|
|
6
|
+
npm install @madj2k/fe-frontend-kit
|
|
7
7
|
```
|
|
8
8
|
Requirements:
|
|
9
9
|
For SCSS mixins: Bootstrap SCSS (your project needs to install bootstrap and include it in the build)
|
|
@@ -17,11 +17,11 @@ For menu components: none
|
|
|
17
17
|
## Usage in your project
|
|
18
18
|
### SCSS Mixins
|
|
19
19
|
```
|
|
20
|
-
@use '@madj2k/frontend-kit' as *;
|
|
20
|
+
@use '@madj2k/fe-frontend-kit' as *;
|
|
21
21
|
```
|
|
22
22
|
Or import individual mixins:
|
|
23
23
|
```
|
|
24
|
-
@use '@madj2k/frontend-kit/sass/00_mixins/colors' as *;
|
|
24
|
+
@use '@madj2k/fe-frontend-kit/sass/00_mixins/colors' as *;
|
|
25
25
|
```
|
|
26
26
|
### Menu components (JS and SCSS):
|
|
27
27
|
Each menu component can be used separately.
|
|
@@ -32,7 +32,7 @@ with opening and closing animation and optional cookie persistence.
|
|
|
32
32
|
|
|
33
33
|
Init:
|
|
34
34
|
```
|
|
35
|
-
import { Madj2kBanner } from '@madj2k/frontend-kit/tools/banner';
|
|
35
|
+
import { Madj2kBanner } from '@madj2k/fe-frontend-kit/tools/banner';
|
|
36
36
|
const banner = new Madj2kBanner({
|
|
37
37
|
bannerId: 'my-banner',
|
|
38
38
|
activeClass: 'active',
|
|
@@ -138,7 +138,7 @@ resize-events during user scrolling on mobile, and respects active input fields
|
|
|
138
138
|
|
|
139
139
|
Init with available options:
|
|
140
140
|
```
|
|
141
|
-
import { Madj2kBetterResizeEvent } from '@madj2k/frontend-kit/tools/better-resize-event';
|
|
141
|
+
import { Madj2kBetterResizeEvent } from '@madj2k/fe-frontend-kit/tools/better-resize-event';
|
|
142
142
|
const betterResizeEvent = new Madj2kBetterResizeEvent({
|
|
143
143
|
resizeEndTimeout: 300,
|
|
144
144
|
scrollingEndTimeout: 600,
|
|
@@ -165,7 +165,7 @@ where elements can be added, removed or re-ordered dynamically.
|
|
|
165
165
|
|
|
166
166
|
Init with available options:
|
|
167
167
|
```
|
|
168
|
-
import { Madj2kScrolling } from '@madj2k/frontend-kit/tools/scrolling';
|
|
168
|
+
import { Madj2kScrolling } from '@madj2k/fe-frontend-kit/tools/scrolling';
|
|
169
169
|
const scrolling = new Madj2kScrolling({
|
|
170
170
|
anchorScrolling: {
|
|
171
171
|
selector: ['a[href^="#"]', 'a[href*="#"]'],
|
|
@@ -200,7 +200,7 @@ and allows overlays to be closed externally via a custom event.
|
|
|
200
200
|
|
|
201
201
|
Init with available options:
|
|
202
202
|
```
|
|
203
|
-
import { Madj2kToggledOverlay } from '@madj2k/frontend-kit/tools/toggled-overlay';
|
|
203
|
+
import { Madj2kToggledOverlay } from '@madj2k/fe-frontend-kit/tools/toggled-overlay';
|
|
204
204
|
const overlayToggle = new Madj2kToggledOverlay('.js-toggled-overlay');
|
|
205
205
|
```
|
|
206
206
|
|
|
@@ -223,14 +223,22 @@ HTML:
|
|
|
223
223
|
Integrate the CSS- and JS-file into your project. Make sure jQuery is included.
|
|
224
224
|
Then init the menu with
|
|
225
225
|
```
|
|
226
|
-
import { Madj2kFlyoutMenu } from '@madj2k/frontend-kit/menus/flyout-menu';
|
|
226
|
+
import { Madj2kFlyoutMenu } from '@madj2k/fe-frontend-kit/menus/flyout-menu';
|
|
227
227
|
document.querySelectorAll('.js-flyout-toggle').forEach((el) => {
|
|
228
228
|
new Madj2kFlyoutMenu(el, { animationDuration: 800 });
|
|
229
229
|
});
|
|
230
230
|
```
|
|
231
|
+
Optional for automatically closing of the flyout menu resizing the browser window:
|
|
232
|
+
```
|
|
233
|
+
import { Madj2kBetterResizeEvent } from '@madj2k/fe-frontend-kit/tools/better-resize-event';
|
|
234
|
+
document.addEventListener('madj2k-better-resize-event', () => {
|
|
235
|
+
document.dispatchEvent(new CustomEvent('madj2k-flyoutmenu-close'));
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
231
239
|
CSS:
|
|
232
240
|
```
|
|
233
|
-
@use '@madj2k/frontend-kit/menus/flyout-menu' as *;
|
|
241
|
+
@use '@madj2k/fe-frontend-kit/menus/flyout-menu' as *;
|
|
234
242
|
```
|
|
235
243
|
|
|
236
244
|
## Basic HTML
|
|
@@ -275,7 +283,7 @@ Otherwise in the opened menu the scrolling won't work.
|
|
|
275
283
|
```
|
|
276
284
|
Then we deactivate the fullHeight of the flyout menu and make the blurry background clickable
|
|
277
285
|
```
|
|
278
|
-
import { Madj2kFlyoutdownMenu } from '@madj2k/frontend-kit/menus/flyout-menu';
|
|
286
|
+
import { Madj2kFlyoutdownMenu } from '@madj2k/fe-frontend-kit/menus/flyout-menu';
|
|
279
287
|
document.querySelectorAll('.js-flyout-toggle').forEach((el) => {
|
|
280
288
|
new Madj2kFlyoutMenu(el, { fullHeight: false });
|
|
281
289
|
});
|
|
@@ -329,14 +337,22 @@ html,body {
|
|
|
329
337
|
Integrate the CSS- and JS-file into your project. Make sure jQuery is included.
|
|
330
338
|
Then init the menu with
|
|
331
339
|
```
|
|
332
|
-
import { Madj2kPulldownMenu } from '@madj2k/frontend-kit/menus/pulldown-menu';
|
|
340
|
+
import { Madj2kPulldownMenu } from '@madj2k/fe-frontend-kit/menus/pulldown-menu';
|
|
333
341
|
document.querySelectorAll('.js-pulldown-toggle').forEach((el) => {
|
|
334
342
|
new Madj2kPulldownMenu(el);
|
|
335
343
|
});
|
|
336
344
|
```
|
|
345
|
+
Optional for automatically closing of the flyout menu resizing the browser window:
|
|
346
|
+
```
|
|
347
|
+
import { Madj2kBetterResizeEvent } from '@madj2k/fe-frontend-kit/tools/better-resize-event';
|
|
348
|
+
document.addEventListener('madj2k-better-resize-event', () => {
|
|
349
|
+
document.dispatchEvent(new CustomEvent('madj2k-pulldownmenu-close'));
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
337
353
|
CSS:
|
|
338
354
|
```
|
|
339
|
-
@use '@madj2k/frontend-kit/menus/pulldown-menu' as *;
|
|
355
|
+
@use '@madj2k/fe-frontend-kit/menus/pulldown-menu' as *;
|
|
340
356
|
```
|
|
341
357
|
|
|
342
358
|
## Basic HTML
|