Browse code

Update

Benjamin Roth authored on17/03/2023 09:52:56
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,252 @@
1
+init(optionalScripts);
2
+
3
+Promise.all(promises)
4
+    .then(function () {
5
+        if (options_lazyload) {
6
+            var lazyLoadInstance = new LazyLoad();
7
+        }
8
+
9
+        if (options_aos) {
10
+            $('*:not([data-aos])[class*="animate__"]').each(function (index) {
11
+                var classes = $.grep(this.className.split(" "), function (v, i) {
12
+                    return v.indexOf("animate__") === 0;
13
+                }).join();
14
+                $(this).removeClass(classes);
15
+                $(this).attr("data-aos", classes);
16
+            });
17
+
18
+            AOS.init({
19
+                // Global settings:
20
+                disable: false, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
21
+                startEvent: "DOMContentLoaded", // name of the event dispatched on the document, that AOS should initialize on
22
+                initClassName: false, // class applied after initialization
23
+                animatedClassName: "animate__animated", // class applied on animation
24
+                useClassNames: true, // if true, will add content of `data-aos` as classes on scroll
25
+                disableMutationObserver: false, // disables automatic mutations' detections (advanced)
26
+                //debounceDelay: 50, // the delay on debounce used while resizing window (advanced)
27
+                //throttleDelay: 99, // the delay on throttle used while scrolling the page (advanced)
28
+
29
+                // Settings that can be overridden on per-element basis, by `data-aos-*` attributes:
30
+                //offset: 0, // offset (in px) from the original trigger point
31
+
32
+                once: true, // whether animation should happen only once - while scrolling down
33
+                mirror: true, // whether elements should animate out while scrolling past them
34
+                anchorPlacement: "top-bottom", // defines which position of the element regarding to window should trigger the animation
35
+            });
36
+        }
37
+
38
+        if (options_popper) {
39
+            if ($('[data-bs-toggle="tooltip"]').length) {
40
+                var tooltipTriggerList = [].slice.call(
41
+                    document.querySelectorAll('[data-bs-toggle="tooltip"]')
42
+                );
43
+                var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
44
+                    return new bootstrap.Tooltip(tooltipTriggerEl);
45
+                });
46
+            }
47
+        }
48
+
49
+
50
+        /* MEGAMENÜ */
51
+        $(document).on("mouseenter", ".mod_navigation li > *:first-child", function () {
52
+            $(".mod_navigation li.mm_container").removeClass("megamenu-active");
53
+
54
+            if ($(this).parent().hasClass("mm_container")) {
55
+                $(this).parent().addClass("megamenu-active");
56
+            }
57
+        });
58
+
59
+        $(document).on(
60
+            "mouseleave",
61
+            ".mod_navigation li.mm_container .mm_dropdown > .inner",
62
+            function () {
63
+                setTimeout(function () {
64
+                    $(".mod_navigation li.mm_container").removeClass("megamenu-active");
65
+                }, 500);
66
+            }
67
+        );
68
+        /* MEGAMENÜ END */
69
+
70
+
71
+        /* MMENU ADDONS */
72
+        if ($(".mod_mmenuHtml a.offCanvasBasketOpener").length) {
73
+            $(".mod_mmenuHtml a.offCanvasBasketOpener").click(function (e) {
74
+                setTimeout(function () {
75
+                    $('body').addClass("mm-wrapper_opened mm-wrapper_blocking")
76
+                }, 1000);
77
+            });
78
+        }
79
+
80
+        if ($(".mmenu_close_button").length) {
81
+            $(".mmenu_close_button").click(function (e) {
82
+                e.preventDefault();
83
+            });
84
+        }
85
+        /* MMENU ADDONS END */
86
+
87
+
88
+        if ($(".accordion-nav").length) {
89
+            $(".accordion-nav").find("i").click(function (e) {
90
+                $(this).closest("li").toggleClass("expanded");
91
+            });
92
+        }
93
+
94
+
95
+        /* Animated Upcounting when Element is in Viewport */
96
+        if ($(".count").length) {
97
+            function startCounter() {
98
+                $(".count").each(function (index) {
99
+                    if (isOnScreen($(this)) && !$(this).hasClass("doneCounting")) {
100
+                        var size = $(this).text().split(".")[1]
101
+                            ? $(this).text().split(".")[1].length
102
+                            : 0;
103
+                        $(this)
104
+                            .prop("Counter", 0)
105
+                            .animate(
106
+                                {
107
+                                    Counter: $(this).text(),
108
+                                },
109
+                                {
110
+                                    duration: 2000,
111
+                                    easing: "swing",
112
+                                    step: function (now) {
113
+                                        $(this).text(parseFloat(now).toFixed(size));
114
+                                        $(this).addClass("doneCounting");
115
+                                    },
116
+                                }
117
+                            );
118
+                    }
119
+                });
120
+            }
121
+
122
+            startCounter();
123
+
124
+            $(window).on("resize scroll", function () {
125
+                startCounter();
126
+            });
127
+        }
128
+        /* END */
129
+
130
+
131
+        /* Behavior of Header Type 1 (not fixed) */
132
+        if ($(".header--content.type--1:not(.fixed)").length) {
133
+            navWrapper = $(".hc--bottom");
134
+            navWrapperHeight = $(".hc--bottom").outerHeight();
135
+            navContainer = $(".hc-bottom--right-col");
136
+            navOffset = navContainer.offset().top - 30;
137
+            imageHeight = $(".ce--mainimage > .image--holder").data("height");
138
+
139
+            if (!imageHeight) {
140
+                imageHeight = 100;
141
+            }
142
+
143
+            $(".ce--mainimage .image--holder:not(.with-maxheight)").css({
144
+                "max-height":
145
+                    "calc(" + imageHeight + "vh - " + $("header").height() + "px)",
146
+            });
147
+
148
+            function detectIfScrolled() {
149
+                if ($(this).scrollTop() > navOffset) {
150
+                    navWrapper.addClass("is--scrolling");
151
+                    $(".header--content .hc--top").css(
152
+                        "margin-bottom",
153
+                        navWrapperHeight + "px"
154
+                    );
155
+                } else {
156
+                    navWrapper.removeClass("is--scrolling");
157
+                    $(".header--content .hc--top").css("margin-bottom", "0px");
158
+                }
159
+            }
160
+
161
+            detectIfScrolled();
162
+
163
+            $(window).scroll(function () {
164
+                detectIfScrolled();
165
+            });
166
+        }
167
+        /* END */
168
+
169
+        /* Behavior of Header Type 1 (fixed) */
170
+        if ($(".header--content.type--1.fixed").length) {
171
+            navWrapper = $(".hc--bottom");
172
+            navContainer = $(".hc-bottom--right-col");
173
+            navOffset = navContainer.offset().top - 15;
174
+
175
+            function detectIfScrolled() {
176
+                if ($(this).scrollTop() > navOffset) {
177
+                    navWrapper.addClass("is--scrolling");
178
+                } else {
179
+                    navWrapper.removeClass("is--scrolling");
180
+                }
181
+            }
182
+
183
+            detectIfScrolled();
184
+
185
+            $(window).scroll(function () {
186
+                detectIfScrolled();
187
+            });
188
+        }
189
+        /* END */
190
+
191
+        /* Behavior of Header Type 2 */
192
+        if ($(".header--content.type--2").length) {
193
+            navWrapper = $(".hc--bottom");
194
+
195
+            if ($(".mod_pageImage").length) {
196
+                navContainer = navWrapper;
197
+                navOffset = navContainer.offset().top - 15;
198
+
199
+            } else {
200
+                navOffset = $('.mainslider').height();
201
+                navWrapper.css("bottom", "auto");
202
+                navWrapper.css("top", navOffset - navWrapper.height());
203
+            }
204
+
205
+            function detectIfScrolled() {
206
+                if ($(this).scrollTop() > (navOffset - navWrapper.height())) {
207
+                    navWrapper.addClass("is--scrolling");
208
+                    navWrapper.css("top", "0px");
209
+                } else {
210
+                    navWrapper.removeClass("is--scrolling");
211
+                    navWrapper.css("top", navOffset - navWrapper.height());
212
+                }
213
+            }
214
+
215
+            detectIfScrolled();
216
+
217
+            $(window).scroll(function () {
218
+                detectIfScrolled();
219
+            });
220
+        }
221
+        /* END */
222
+
223
+        /* Behavior of Header Type 6 */
224
+        if ($(".header--content.type--6").length) {
225
+
226
+            function detectIfScrolled() {
227
+                var scroll = $(window).scrollTop();
228
+                var os = $('#header').offset().top;
229
+                var ht = $('#header').height();
230
+                if (scroll > os + ht) {
231
+                    $('body').addClass('is--scrolling');
232
+                } else {
233
+                    $('body').removeClass('is--scrolling');
234
+                }
235
+            }
236
+
237
+            detectIfScrolled();
238
+
239
+            $(window).scroll(function () {
240
+                detectIfScrolled();
241
+            });
242
+        }
243
+        /* END */
244
+
245
+        setInterval(function () {
246
+            $("body").css('opacity', 1);
247
+        }, 250, true);
248
+
249
+    })
250
+    .catch(function (script) {
251
+        console.log(script + " failed to load");
252
+    });