PageSourceSearch

https://www.aktivmobil-bw.de/_assets/12e427880ce66b6e5fbfa1cbcf7fe005/JavaScript/custom.js?1790840300

js aktivmobil-bw.de collected 2026-10-02 14:31:46 UTC 14,857 bytes, 470 lines download raw bytes

1$(document).foundation();
2var tx_kiwiaccordion_exclusive =0;
3var tx_kiwiaccordion_effect = "fade";
4
5if (!pausen) {var pausen = 5000;} else {var pausen = pausen*1000;}
6
7let totop = document.querySelector(".totop");
8
9let myScrollFunc = function() {
10    let y = window.scrollY
11    let h = document.body.scrollHeight/4
12    //console.log(h)
13    if (y >= h) {
14        totop.classList.add('show')
15    } else {
16        totop.classList.remove('show')
17    }
18};
19
20window.addEventListener("scroll", myScrollFunc);
21
22$(document).ready(function() {
23
24    /* alle aufklappen wieder raus
25    let alle = $('.ka-panel:first').prepend('<button class="accbutton button" style="font-family: Work Sans;">Alle aufklappen</button>')
26    $(alle).on('click', function(){
27        $('.ka-panel .ka-handler').trigger('click');
28        if ($('.accbutton:first').text() == 'Alle aufklappen') {
29            $('.accbutton').html('Alle zuklappen')
30        } else {
31            $('.accbutton').html('Alle aufklappen')
32        }
33    }) */
34
35    /*
36    $('.bx-slider').bxSlider({
37        auto: false,
38        stopAutoOnClick: true,
39        pause: 10000,
40        pager: true,
41        prevText: '',
42        nextText: '',
43    });*/
44
45    $(".topslider").slick({
46        dots: true,
47        arrows: true,
48        slidesToShow: 1,
49        slidesToScroll: 1,
50        autoplay: true,
51        autoplaySpeed: 10000
52    });
53
54    $(".fokusslider").slick({
55        dots: true,
56        customPaging : function(slider, i) {
57            var title = $(slider.$slides[i].children[0].children[0]).data('title');
58            console.log($(slider.$slides[i]));
59            return '<a class="pager__item">'+title+'</a>';
60        },
61        arrows: true,
62        slidesToShow: 1,
63        slidesToScroll: 1
64    });
65
66    $( ".sliderwrapper " ).each(function() {
67        let stage = $(this).find('.slider-gallery')
68        let nav = $(this).find('.slider-gallery-nav')
69        $(stage).slick({
70            slidesToShow: 1,
71            slidesToScroll: 1,
72            arrows: false,
73            fade: true,
74            asNavFor: nav
75        });
76        $(nav).slick({
77            slidesToShow: 5,
78            slidesToScroll: 1,
79            asNavFor: stage,
80            dots: false,
81            centerMode: true,
82            focusOnSelect: true,
83            //infinite: false
84        });
85    });
86
87    $('.lightbox').magnificPopup({
88        type: 'image',
89        closeOnContentClick: 'true',
90        verticalFit: 'false',
91        image: {
92            titleSrc: function (item) {
93                return item.el.next().clone();
94            }
95        },
96    });
97
98    $('.popup-gallery').magnificPopup({
99        delegate: 'a',
100        type: 'image',
101        tLoading: 'Lade Bild #%curr%...',
102        mainClass: 'mfp-img-mobile',
103        gallery: {
104            enabled: true,
105            navigateByImgClick: true,
106            tCounter: '<span class="mfp-counter">%curr% von %total%</span>', // markup of counter
107            preload: [0,1] // Will preload 0 - before current, and 1 after the current image
108        },
109        image: {
110            tError: '<a href="%url%">Das Bild #%curr%</a> konnte nicht geladen werden.',
111            titleSrc: function(item) {
112                let c = ''
113                if(item.el.attr('alt').length>0) {  c = ' – © '}
114                return item.el.attr('title') + ' ' + c + item.el.attr('alt');
115            }
116        }
117    });
118
119
120
121    $('.open-popup-link').magnificPopup({
122        type:'inline',
123        midClick: true, // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
124        closeBtnInside: false,
125        callbacks: {
126            open: function() {
127                $('.mfp-content .slider-gallery').slick('refresh');
128                $('.mfp-content .slider-gallery-nav').slick('refresh');
129            }
130        }
131    });
132
133    // remove image from news videos
134    $('.article').find('.mediaelement').prev('.news-img-wrap').hide();
135
136    $("#mobile-menu").mmenu({
137        extensions: ["position-right"]
138    });
139    var API = $('#mobile-menu').data("mmenu");
140    $('.mobile-trigger').on('click', function(){
141        API.open();
142    })
143
144    $('#topteaser').on('postEqualized.zf.Equalizer', function() {
145        if (Foundation.MediaQuery.current == 'small') {
146            $(this).find('[data-equalizer-watch]').css('height','auto');
147        }
148    }).trigger('postEqualized.zf.Equalizer');
149
150
151    $('[allowfullscreen]').wrap('<div class="elastic-video"></div>');
152
153    if ($.cookie('veranstaltungshinweis') != 'entfernt') {
154        $('.newslettermodal').addClass('is-shown');
155    }
156
157    $('.newslettermodal .close').on('click', function(){
158        $.cookie('veranstaltungshinweis', 'entfernt', { expires: 7, path: '/' });
159        $('.newslettermodal').removeClass('is-shown');
160    })
161
162    // Megamenü
163
164    function closeAllMegamenus() {
165        $('.megamenu').hide().attr('aria-hidden', 'true');
166        $('#mainmenu>ul>li>a').attr('aria-expanded', 'false');
167    }
168
169    function openMegamenu($trigger) {
170        let $menu = $trigger.closest('li').find('.megamenu').first();
171
172        closeAllMegamenus();
173
174        if (!$menu.length) {
175            return;
176        }
177
178        $trigger.attr('aria-expanded', 'true');
179        $menu.show().attr('aria-hidden', 'false');
180    }
181
182    $('#mainmenu>ul>li').each(function(index){
183        let $li = $(this);
184        let $trigger = $li.children('a');
185        let $menu = $li.children('.megamenu').first();
186
187        if ($menu.length) {
188            let menuId = $menu.attr('id') || 'megamenu-' + index;
189
190            $menu.attr({
191                id: menuId,
192                'aria-hidden': 'true'
193            });
194
195            $trigger.attr({
196                'aria-haspopup': 'true',
197                'aria-expanded': 'false',
198                'aria-controls': menuId
199            });
200        }
201    });
202
203    $('#mainmenu>ul>li').on('mouseover focusin', function(){
204        let $trigger = $(this).children('a');
205
206        if ($(this).children('.megamenu').length) {
207            openMegamenu($trigger);
208        } else {
209            closeAllMegamenus();
210        }
211    });
212
213    $('#mainmenu>ul>li>a').on('keydown', function(event){
214        let $trigger = $(this);
215        let $menu = $trigger.closest('li').children('.megamenu').first();
216        let $focusableItems = $menu.find('a, button, [tabindex]:not
216([tabindex="-1"])').filter(':visible');
217        let $topLevelItems = $('#mainmenu>ul>li>a:visible');
218        let currentIndex = $topLevelItems.index($trigger);
219        let key = event.key;
220
221        if (key === 'ArrowRight') {
222            event.preventDefault();
223
224            if ($topLevelItems.length) {
225                let nextIndex = (currentIndex + 1) % $topLevelItems.length;
226                let $nextTrigger = $topLevelItems.eq(nextIndex);
227                $nextTrigger.focus();
228
229                if ($nextTrigger.closest('li').children('.megamenu').length) {
230                    openMegamenu($nextTrigger);
231                } else {
232                    closeAllMegamenus();
233                }
234            }
235
236            return;
237        }
238
239        if (key === 'ArrowLeft') {
240            event.preventDefault();
241
242            if ($topLevelItems.length) {
243                let prevIndex = (currentIndex - 1 + $topLevelItems.length) % $topLevelItems.length;
244                let $prevTrigger = $topLevelItems.eq(prevIndex);
245                $prevTrigger.focus();
246
247                if ($prevTrigger.closest('li').children('.megamenu').length) {
248                    openMegamenu($prevTrigger);
249                } else {
250                    closeAllMegamenus();
251                }
252            }
253
254            return;
255        }
256
257        if (!$menu.length) {
258            return;
259        }
260
261        if (key === 'Enter' || key === ' ') {
262            event.preventDefault();
263            openMegamenu($trigger);
264            return;
265        }
266
267        if (key === 'ArrowDown') {
268            event.preventDefault();
269            openMegamenu($trigger);
270            $focusableItems.first().focus();
271            return;
272        }
273
274        if (key === 'Tab' && !event.shiftKey) {
275            openMegamenu($trigger);
276
277            if ($focusableItems.length) {
278                event.preventDefault();
279                $focusableItems.first().focus();
280            }
281
282            return;
283        }
284
285        if (key === 'Escape') {
286            event.preventDefault();
287            closeAllMegamenus();
288            $trigger.focus();
289        }
290    });
291
292    $('.megamenu').on('mouseleave', function(){
293        closeAllMegamenus();
294    });
295
296    $('.megamenu').on('keydown', function(event){
297        if (event.key === 'Escape') {
298            event.preventDefault();
299            let $parentTrigger = $(this).closest('li').children('a');
300            closeAllMegamenus();
301            $parentTrigger.focus();
302        }
303    });
304
305    $('#mainmenu').on('mouseleave', function(){
306        closeAllMegamenus();
307    });
308
309    $('#mainmenu>ul>li').on('focusout', function(){
310        let $li = $(this);
311
312        setTimeout(function() {
313            if (!$li.find(document.activeElement).length) {
314                $li.children('.megamenu').hide().attr('aria-hidden', 'true');
315                $li.children('a').attr('aria-expanded', 'false');
316            }
317        }, 0);
318    });
319
320    $('body').on('click keydown', '.menu-level-2>li>a', function(event){
321        let isKeyboardToggle = event.type === 'keydown' && (event.key === 'Enter' || event.key === ' ');
322        let isClick = event.type === 'click';
323
324        if (!isKeyboardToggle && !isClick) {
325            return;
326        }
327
328        let hassub = $(this).closest('li').hasClass('hassub');
329        let sellevel3 = $(this).closest('li').find('.menu-level-3').first();
330        let selli = $(this).closest('li');
331        let isActive = $(selli).hasClass('active');
332
333        if(hassub) {
334            event.preventDefault();
335
336            if (isActive) {
337                $(sellevel3).hide().attr('aria-hidden', 'true');
338                $(selli).removeClass('active');
339                $(this).attr('aria-expanded', 'false');
340            } else {
341                $(sellevel3).show().attr('aria-hidden', 'false');
342                $(selli).addClass('active');
343                $(this).attr('aria-expanded', 'true');
344            }
345        }
346    });
347
348    $('.menu-level-2>li.hassub').each(function(index){
349        let $li = $(this);
350        let $trigger = $li.children('a');
351        let $submenu = $li.find('.menu-level-3').first();
352
353        if ($submenu.length) {
354            let submenuId = $submenu.attr('id') || 'menu-level-3-' + index;
355            $submenu.attr({
356                id: submenuId,
357                'aria-hidden': 'true'
358            }).hide();
359            $trigger.attr({
360                'aria-haspopup': 'true',
361                'aria-expanded': 'false',
362                'aria-controls': submenuId
363            });
364        }
365    });
366
367    $('.megamenu .innermenu').each(function() {
368        let $innerMenu = $(this);
369        let $firstColumn = $innerMenu.children('ul.menu-level-2.col1').first();
370
371        if (!$firstColumn.length) {
372            $firstColumn = $innerMenu.children('ul.menu-level-2').first();
373            $firstColumn.addClass('col1');
374        }
375
376        if (!$firstColumn.length) {
377            return;
378        }
379
380        $innerMenu.children('ul.menu-level-2.col2').remove();
381
382        let postsArr = [];
383
384        $firstColumn.children('li').each(function(){
385            postsArr.push($(this).prop('outerHTML'));
386        });
387
388        let firstList = postsArr.slice(0, Math.round(postsArr.length / 2));
389        let secondList = postsArr.slice(Math.round(postsArr.length / 2));
390
391        function createHTML(list) {
392            let listHTML = '';
393
394            for (let i = 0; i < list.length; i++) {
395                listHTML += list[i];
396            }
397
398            return listHTML;
399        }
400
401        $firstColumn.html(createHTML(firstList));
402
403        if (secondList.length) {
404            $('<ul class="menu-level-2 col2"></ul>')
405                .html(createHTML(secondList))
406                .appendTo($innerMenu);
407        }
408    });
409
410    $('html').removeClass('no-javascript')
411
412    $(".twentytwenty-container").twentytwenty({
413        default_offset_pct: 0.7, // How much of the before image is visible when the page loads
414        before_label: 'vorher', // Set a custom before label
415        after_label: 'nachher', // Set a custom after label
416        no_overlay: true, //Do not show the overlay with before and after
417        move_slider_on_hover: false, // Move slider on mouse hover?
418        move_with_handle_only: true, // Allow a user to swipe anywhere on the image to control slider movement.
419        click_to_move: true // Allow a user to click (or tap) anywhere on the image to move the slider to that location.
420    });
421
422})
423
424document.addEventListener('DOMContentLoaded', function () {
425    const topFoto = document.querySelector('.topfoto');
426    const originalContainer = topFoto?.parentNode; // Der ursprüngliche Container des `.topfoto`-Elements
427    const originalNextSibling = topFoto?.nextSibling; // Das Element, das ursprünglich direkt nach `.topfoto` kommt
428
429    function moveTopFotoIfNeeded() {
430        const content = document.querySelector('.content');
431        const firstH2 = content ? content.querySelector('h2') : null;
432
433        // Überprüfe, ob `.topfoto` überhaupt existiert
434        if (!topFoto) {
435            console.warn('Das .topfoto-Element existiert nicht.');
436            return;
437        }
438
439        // Wenn die Bildschirmbreite kleiner als 640px ist
440        if (window.innerWidth < 640) {
441            if (content && firstH2) {
442                // Verschiebe `.topfoto` unter das erste `h2`
443                if (!firstH2.parentNode.contains(topFoto)) {
444                    firstH2.parentNode.insertBefore(topFoto, firstH2.nextSibling);
445                }
446            } else {
447                console.warn(
448                    'Entweder .content oder ein h2-Element innerhalb von .content fehlt. .topfoto bleibt unverändert.'
449                );
450            }
451        } else {
452            // Verschiebe `.topfoto` zurück an den Anfang seines ursprünglichen Containers
453            if (originalContainer && topFoto) {
454                if (originalNextSibling) {
455                    // Setze `.topfoto` vor das ursprüngliche Nachelement, falls es existiert
456                    originalContainer.insertBefore(topFoto, originalNextSibling);
457                } else {
458                    // Falls das ursprüngliche Nachelement nicht existiert, füge `.topfoto` ans Ende des Containers hinzu
459                    originalContainer.appendChild(topFoto);
460                }
461            }
462        }
463    }
464
465    // Initial aufrufen
466    moveTopFotoIfNeeded();
467
468    // Funktion bei Resizing des Fensters auslösen
469    window.addEventListener('resize', moveTopFotoIfNeeded);
470});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.