PageSourceSearch

https://www.muzeumtatra.cz/templates/shaper_helixultimate/css/mycss/assets/akce.js

js muzeumtatra.cz collected 2026-10-02 19:59:12 UTC 5,701 bytes, 152 lines download raw bytes

1jQuery(document).ready(function($) {    
2
3    let scrollAmount = 0;
4    const items = $('.event-block').length; // Počet akcí
5
6    // Získání počtu akcí na základě šířky obrazovky
7    function getScrollStep() {
8        const windowWidth = $(window).width();
9        if (windowWidth <= 768) {
10            return 100; // Mobil - posun o 50% (2 akce)
11        } else if (windowWidth <= 1024) {
12            return 33.33; // Tablet - posun o 33.33% (3 akce)
13        } else {
14            return 20; // PC - posun o 20% (5 akcí)
15        }
16    }
17    
18    let currentSlide = 0; // Počáteční pozice
19    const totalSlides = items - visibleItems; // Celkový počet posunů // Celkový počet posuvů, pokud zobrazujete 5 akcí najednou
20    console.log('Celkem posunu: ' + totalSlides);
21    // Kontrola, zda je otevřený prvek
22    function isElementOpen() {
23        return $('.event-block.openElement').length > 0;
24    }
25
26    
27    function updateShrinkElements() {
28        const visibleStart = currentSlide; // První viditelný prvek
29        const visibleEnd = currentSlide + getScrollStep(); // Poslední viditelný prvek
30    
31        // Projdeme všechny eventy a aplikujeme shrink pouze těm, které jsou ve viditelném rozmezí
32        $('.event-block').each(function(index) {
33            if (index >= visibleStart && index < visibleEnd) {
34                // Tento prvek je viditelný, aplikujeme shrinkElement
35                $(this).removeClass('openElement').addClass('shrinkElement');
36            } else {
37                // Tento prvek je mimo zorné pole, odstraníme shrinkElement
38                $(this).removeClass('shrinkElement');
39            }
40        });
41    }
42    
43    // Skrytí šipek při otevření akce
44    function toggleArrows() {
45        if (isElementOpen()) {
46            $('.arrow-left, .arrow-right').hide(); // Skryjeme šipky, když je prvek otevřený
47        } else {
48            $('.arrow-left, .arrow-right').show(); // Znovu zobrazíme šipky, když je vše zavřené
49        }
50    }   
51    
52    // Posun doprava
53    $('.arrow-right').click(function() {
54        if (isElementOpen()) return; // Zablokujeme posun, pokud je něco otevřené
55    
56        const scrollStep = getScrollStep();
57        currentSlide++;
58    
59        if (currentSlide > totalSlides) {
60            currentSlide = 0;
61        }
62    
63        $('.sppb-row').css('left', '-' + (currentSlide * scrollStep) + '%');
64    });
65    
66    // Posun doleva
67    $('.arrow-left').click(function() {
68        if (isElementOpen()) return; // Zablokujeme posun, pokud je něco otevřené
69    
70        const scrollStep = getScrollStep();
71        currentSlide--;
72    
73        if (currentSlide < 0) {
74            currentSlide = totalSlides;
75        }
76    
77        $('.sppb-row').css('left', '-' + (currentSlide * scrollStep) + '%');
78    });
79/*
80    var windowWidth1 = window.innerWidth;
81    if (windowWidth1 <= 768) {
82    // Přidání podpory pro swipe gesta
83        $('.sppb-row').swipe({
84            swipeLeft: function() {
85                if (isElementOpen()) return; // Zablokujeme posun, pokud je něco otevřené
86        
87                const scrollStep = 100;
88                console.log('Swipe left - scrollStep:', scrollStep, 'currentSlide:', currentSlide);
89                currentSlide++;
90        
91                if (currentSlide > totalSlides) {
92                    currentSlide = 0;
93                }
94        
95                $('.sppb-row').css('left', '-' + (currentSlide * scrollStep) + '%');
96            },
97            swipeRight: function() {
98                if (isElementOpen()) return; // Zablokujeme posun, pokud je něco otevřené
99        
100                const scrollStep = getScrollStep();
101                console.log('Swipe right - scrollStep:', scrollStep, 'currentSlide:', currentSlide);
102                currentSlide--;
103        
104                if (currentSlide < 0) {
105                    currentSlide = totalSlides;
106                }
107        
108                $('.sppb-row').css('left', '-' + (currentSlide * scrollStep) + '%');
109            },
110            threshold: 75 // Nastavení citlivosti na swipe
111        });
112    }
113*/
114    // Zajištění resetování pozice při změně velikosti okna
115    $(window).resize(function() {
116        scrollAmount = 0;
117        $('.sppb-row').css('transform', 'translateX(0)');
118    });
119    
120    // Spustíme tuto funkci pokaždé, když se něco otevře nebo se carousel posune
121    $('.event-block').on('click', function() {
122        if (!$(this).hasClass('openElement')) {
123            // Aktualizujeme viditelné prvky
124            updateShrinkElements();
125            
126            // Nastavíme otevření aktuálního prvku
127            $(this).removeClass('shrinkElement').addClass('openElement');
128            toggleArrows();
129        }
130    });
131
132    // Kliknutí na zavírací tlačítko zavře detaily
133    $('.close-btn').on('click', function(e) {
134        e.stopPropagation(); // Zabrání kliknutí na celý blok
135        // Zavřeme otevřený blok        
136        $(this).closest('.event-block').removeClass('openElement').addClass('shrinkElement');
137        toggleArrows();
138        
139        // Odstraníme shrinkElement z ostatních bloků a vrátíme je na původní velikost
140        $('.event-block').removeClass('shrinkElement');
141    });    
142    
143});
144
145jQuery(document).ready(function($) {
146    // Funkce, která zjistí výšku obrázku a použije ji jako výšku pro .event-details
147    function updateEventDetailsHeight(block) {
148        var imgHeight = block.find('.images-wrap > img').height(); // Získání výšky obrázku
149        block.find('.event-details').css('height', imgHeight + 'px'); // Nastaví výšku na event-details
150    }
151
152});

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.