@iris.interactive/handcook 4.0.15 → 4.0.16
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/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Welcome to HandCook 👨🍳
|
|
2
|
-

|
|
3
3
|

|
|
4
4
|
[](#)
|
|
5
5
|
[](https://twitter.com/captain\_iris)
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@ export class HcScrollReveal {
|
|
|
29
29
|
constructor() {
|
|
30
30
|
|
|
31
31
|
//Get all scrollreveal elements
|
|
32
|
-
const items = Array.prototype.slice.call(document.querySelectorAll(ElementEnum.scrollReveal)).concat(Array.prototype.slice.call(document.querySelectorAll(ElementEnum.scrollRevealChildren)));
|
|
32
|
+
const items = Array.prototype.slice.call(document.querySelectorAll(ElementEnum.scrollRevealParent)).concat(Array.prototype.slice.call(document.querySelectorAll(ElementEnum.scrollReveal))).concat(Array.prototype.slice.call(document.querySelectorAll(ElementEnum.scrollRevealChildren)));
|
|
33
33
|
|
|
34
34
|
//Init scrollreveal
|
|
35
35
|
HcScrollReveal.init(items);
|
|
@@ -61,12 +61,18 @@ export class HcScrollReveal {
|
|
|
61
61
|
let isChild = false;
|
|
62
62
|
|
|
63
63
|
//Get options
|
|
64
|
-
if (
|
|
64
|
+
if (item.hasAttribute('data-hc-scroll-reveal')) {
|
|
65
|
+
options = HcScrollReveal.getOptions(item);
|
|
66
|
+
} else {
|
|
65
67
|
let parent = item.parentElement;
|
|
66
|
-
|
|
68
|
+
|
|
69
|
+
if (item.hasAttribute('data-hc-scroll-reveal-parent') && parent.hasAttribute('data-hc-scroll-reveal-parent')) {
|
|
70
|
+
isChild = true;
|
|
71
|
+
} else if (!item.hasAttribute('data-hc-noscroll-reveal')) {
|
|
72
|
+
isChild = true;
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
options = HcScrollReveal.getOptions(parent);
|
|
68
|
-
} else {
|
|
69
|
-
options = HcScrollReveal.getOptions(item);
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
//Apply options if different than default
|
|
@@ -87,20 +93,20 @@ export class HcScrollReveal {
|
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
//Interval on items in same row
|
|
90
|
-
if (options.interval !== HcScrollReveal.intervalDefault && options.interval !== null && options.
|
|
96
|
+
if (options.interval !== HcScrollReveal.intervalDefault && options.interval !== null && options.delay !== null) {
|
|
91
97
|
if (isChild) {
|
|
92
98
|
if (childOffset == item.offsetTop) {
|
|
93
|
-
let
|
|
99
|
+
let delayValue = parseInt(options.delay.replace('ms', ''));
|
|
94
100
|
let intervalValue = parseInt(options.interval.replace('ms', ''));
|
|
95
|
-
let
|
|
96
|
-
options.
|
|
101
|
+
let newDelay = delayValue + (intervalValue * childRowCount);
|
|
102
|
+
options.delay = newDelay+'ms';
|
|
97
103
|
childRowCount++;
|
|
98
104
|
} else {
|
|
99
105
|
childOffset = item.offsetTop;
|
|
100
106
|
childRowCount = 1;
|
|
101
107
|
}
|
|
102
108
|
|
|
103
|
-
item.style.setProperty('--hc-scroll-reveal-
|
|
109
|
+
item.style.setProperty('--hc-scroll-reveal-delay', options.delay);
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
|