@hortonstudio/main 1.7.9 → 1.7.11
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/autoInit/counter.js +5 -5
- package/autoInit/navbar.js +4 -0
- package/index.js +1 -1
- package/package.json +1 -1
package/autoInit/counter.js
CHANGED
|
@@ -64,7 +64,7 @@ export function init() {
|
|
|
64
64
|
observer = new IntersectionObserver((entries) => {
|
|
65
65
|
entries.forEach((entry) => {
|
|
66
66
|
if (entry.isIntersecting && !entry.target.dataset.animated) {
|
|
67
|
-
const numberElement = entry.target.querySelector('[data-hs-
|
|
67
|
+
const numberElement = entry.target.querySelector('[data-hs-anim="counter"]');
|
|
68
68
|
startAnimation(numberElement);
|
|
69
69
|
entry.target.dataset.animated = "true";
|
|
70
70
|
}
|
|
@@ -84,7 +84,7 @@ export function init() {
|
|
|
84
84
|
const statsElements = document.querySelectorAll('[data-hs-counter="wrapper"]');
|
|
85
85
|
|
|
86
86
|
statsElements.forEach((element) => {
|
|
87
|
-
const numberElement = element.querySelector('[data-hs-
|
|
87
|
+
const numberElement = element.querySelector('[data-hs-anim="counter"]');
|
|
88
88
|
const originalText = numberElement.getAttribute("data-hs-original");
|
|
89
89
|
|
|
90
90
|
element.setAttribute("aria-label", originalText);
|
|
@@ -101,7 +101,7 @@ export function init() {
|
|
|
101
101
|
const wrappers = document.querySelectorAll('[data-hs-counter="wrapper"]');
|
|
102
102
|
|
|
103
103
|
wrappers.forEach((wrapper) => {
|
|
104
|
-
const numberElement = wrapper.querySelector('[data-hs-
|
|
104
|
+
const numberElement = wrapper.querySelector('[data-hs-anim="counter"]');
|
|
105
105
|
const parsed = parseText(numberElement.textContent.trim());
|
|
106
106
|
|
|
107
107
|
numberElement.setAttribute("data-hs-original", numberElement.textContent.trim());
|
|
@@ -119,7 +119,7 @@ export function init() {
|
|
|
119
119
|
|
|
120
120
|
function triggerAnimation(selector) {
|
|
121
121
|
const wrapper = document.querySelector(selector);
|
|
122
|
-
const numberElement = wrapper.querySelector('[data-hs-
|
|
122
|
+
const numberElement = wrapper.querySelector('[data-hs-anim="counter"]');
|
|
123
123
|
startAnimation(numberElement);
|
|
124
124
|
wrapper.dataset.animated = "true";
|
|
125
125
|
}
|
|
@@ -127,7 +127,7 @@ export function init() {
|
|
|
127
127
|
function reset() {
|
|
128
128
|
counters.forEach((wrapper) => {
|
|
129
129
|
delete wrapper.dataset.animated;
|
|
130
|
-
const numberElement = wrapper.querySelector('[data-hs-
|
|
130
|
+
const numberElement = wrapper.querySelector('[data-hs-anim="counter"]');
|
|
131
131
|
numberElement.textContent = numberElement.getAttribute("data-hs-original");
|
|
132
132
|
});
|
|
133
133
|
|
package/autoInit/navbar.js
CHANGED
|
@@ -477,6 +477,10 @@ function setupMenuButton() {
|
|
|
477
477
|
if (!isMenuOpen) return;
|
|
478
478
|
isMenuOpen = false;
|
|
479
479
|
|
|
480
|
+
// Close all open menu dropdowns
|
|
481
|
+
const openDropdownButtons = menu.querySelectorAll('[data-hs-nav="menu-dropdown-btn"][aria-expanded="true"]');
|
|
482
|
+
openDropdownButtons.forEach(button => button.click());
|
|
483
|
+
|
|
480
484
|
document.body.classList.remove("u-overflow-hidden");
|
|
481
485
|
|
|
482
486
|
const activeMenuButton = Array.from(menuButtons).find(() => menu.contains(document.activeElement));
|
package/index.js
CHANGED