@caweb/framework 1.9.4 → 1.9.6
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/package.json +1 -1
- package/src/scripts/components/header.js +28 -14
- package/build/delta.asset.php +0 -1
- package/build/delta.css +0 -16088
- package/build/delta.js +0 -114
- package/build/eureka.asset.php +0 -1
- package/build/eureka.css +0 -16088
- package/build/eureka.js +0 -114
- package/build/mono.asset.php +0 -1
- package/build/mono.css +0 -16088
- package/build/mono.js +0 -114
- package/build/oceanside.asset.php +0 -1
- package/build/oceanside.css +0 -16088
- package/build/oceanside.js +0 -114
- package/build/orangecounty.asset.php +0 -1
- package/build/orangecounty.css +0 -16088
- package/build/orangecounty.js +0 -114
- package/build/pasorobles.asset.php +0 -1
- package/build/pasorobles.css +0 -16088
- package/build/pasorobles.js +0 -114
- package/build/sacramento.asset.php +0 -1
- package/build/sacramento.css +0 -16088
- package/build/sacramento.js +0 -114
- package/build/santabarbara.asset.php +0 -1
- package/build/santabarbara.css +0 -16088
- package/build/santabarbara.js +0 -114
- package/build/santacruz.asset.php +0 -1
- package/build/santacruz.css +0 -16088
- package/build/santacruz.js +0 -114
- package/build/shasta.asset.php +0 -1
- package/build/shasta.css +0 -16088
- package/build/shasta.js +0 -114
- package/build/sierra.asset.php +0 -1
- package/build/sierra.css +0 -16088
- package/build/sierra.js +0 -114
- package/build/trinity.asset.php +0 -1
- package/build/trinity.css +0 -16088
- package/build/trinity.js +0 -114
package/package.json
CHANGED
|
@@ -11,7 +11,8 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
11
11
|
document.querySelector('.utility-header'),
|
|
12
12
|
].filter(Boolean);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const getCompactedElementsHeight = () => {
|
|
15
|
+
return compactedElements.reduce((total, element) => {
|
|
15
16
|
if( element instanceof HTMLElement ){
|
|
16
17
|
return total + element.clientHeight;
|
|
17
18
|
}
|
|
@@ -19,6 +20,9 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
19
20
|
return total;
|
|
20
21
|
|
|
21
22
|
}, 0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let compactedElementsHeight = getCompactedElementsHeight();
|
|
22
26
|
|
|
23
27
|
// lets collect the height of any fixed elements above the header.
|
|
24
28
|
let topOffset = 0;
|
|
@@ -52,7 +56,6 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
52
56
|
|
|
53
57
|
|
|
54
58
|
const compactHeader = () => {
|
|
55
|
-
|
|
56
59
|
// downscroll code passed the header height
|
|
57
60
|
if (document.body.scrollTop >= header.offsetHeight ||
|
|
58
61
|
document.documentElement.scrollTop >= header.offsetHeight
|
|
@@ -76,21 +79,32 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
76
79
|
|
|
77
80
|
};
|
|
78
81
|
|
|
82
|
+
// we need to update the compacted elements height if an alert is closed, so we listen for the alert close event and update the compacted elements height.
|
|
83
|
+
document.querySelectorAll('header .alerts [data-bs-dismiss="alert"]').forEach((closeButton) => {
|
|
84
|
+
closeButton.addEventListener('click', () => {
|
|
85
|
+
compactedElementsHeight = getCompactedElementsHeight();
|
|
86
|
+
document.querySelectorAll('#page-container [id]').forEach(updateScrollMarginTop);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
79
90
|
// for each element with an id we add the scroll-margin-top
|
|
80
|
-
|
|
91
|
+
const updateScrollMarginTop = (element) => {
|
|
81
92
|
if( element instanceof HTMLElement ){
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
let scrollMarginHeight = header.clientHeight + topOffset;
|
|
94
|
+
|
|
95
|
+
// if the elements offsetTop is greater than twice the header size,
|
|
96
|
+
// we can assume the header is compacted
|
|
97
|
+
// so we need to subtract the compacted elements height from the scroll margin.
|
|
98
|
+
if( element.offsetTop > scrollMarginHeight + (scrollMarginHeight / 2) ){
|
|
99
|
+
scrollMarginHeight -= compactedElementsHeight;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
element.style.scrollMarginTop = `${scrollMarginHeight}px`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
90
105
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
106
|
+
// add scroll margin top to all elements with an id, so that when we scroll to them, they are not hidden behind the header.
|
|
107
|
+
document.querySelectorAll('#page-container [id]').forEach(updateScrollMarginTop);
|
|
94
108
|
|
|
95
109
|
// reset position on scroll
|
|
96
110
|
window.addEventListener(
|
package/build/delta.asset.php
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<?php return array('dependencies' => array(), 'version' => '199f529ffe27046b976c');
|