@iris.interactive/handcook 2.6.13 → 2.6.14
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
|
@@ -25,11 +25,11 @@ export class HcSlider {
|
|
|
25
25
|
// Options
|
|
26
26
|
options = {};
|
|
27
27
|
|
|
28
|
-
constructor(elements = ElementEnum.slider) {
|
|
28
|
+
constructor(elements = ElementEnum.slider, options = {}) {
|
|
29
29
|
this.initOptions();
|
|
30
30
|
document.querySelectorAll(elements).forEach(element => {
|
|
31
31
|
this.slider = element;
|
|
32
|
-
this.setOptions();
|
|
32
|
+
this.setOptions(options);
|
|
33
33
|
this.buildDom();
|
|
34
34
|
const instance = new Swiper(element, this.options);
|
|
35
35
|
this.instances.push(instance);
|
|
@@ -37,7 +37,7 @@ export class HcSlider {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
setOptions() {
|
|
40
|
+
setOptions(options) {
|
|
41
41
|
const attr = this.slider.getAttribute('data-hc-slider-autoplay');
|
|
42
42
|
if (attr !== null) {
|
|
43
43
|
this.options['autoplay'] = {
|
|
@@ -87,6 +87,9 @@ export class HcSlider {
|
|
|
87
87
|
enabled: true
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
// Override option passing in function js
|
|
92
|
+
Object.assign( this.options, options );
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
buildDom() {
|
|
@@ -186,7 +189,7 @@ export class HcSlider {
|
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
191
|
|
|
189
|
-
const hc_slider = function (trigger) {
|
|
190
|
-
return new HcSlider(trigger);
|
|
192
|
+
const hc_slider = function (trigger, options) {
|
|
193
|
+
return new HcSlider(trigger, options);
|
|
191
194
|
}
|
|
192
195
|
export default hc_slider;
|