PageSourceSearch

https://www.lapetitecour-lille.fr/wp-content/themes/lapetitecour/js/main.js?v=20240927

js lapetitecour-lille.fr collected 2026-10-08 10:30:39 UTC 9,037 bytes, 353 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3    var scrollCallbacks = $.Callbacks();
4
5    // Diaporama
6    $('#slider').bxSlider({
7        pause: 11000,
8        pager: false,
9        auto: true,
10        mode: 'fade',
11        touchEnabled : false
12    });
13
14
15    // Parallax
16    $('#section-2').parallax("50%", 0.04);
17    $('#section-3').parallax("50%", 0.04);
18    $('#section-4').parallax("50%", 0.04);
19
20    $('.garnish-1').parallax("120%", 0.3);
21    $('.garnish-2').parallax("right", 0.1);
22    $('.garnish-3').parallax("0", 0.2);
23    $('.garnish-4').parallax("0", 0.2);
24
25    // URLs
26    (function () {
27
28        var updateUrl = function (url) {
29            if (Modernizr.history) {
30                window.history.pushState(null, '', url);
31            }
32        };
33
34        var onScroll = function () {
35
36            //var scrollTop = $(window).scrollTop();
37
38            //$('.section').each(function () {
39
40            //var $this = $(this);
41            //var posX = $this.data('posX');
42            //var height = $this.data('height');
43
44            //if (posX - scrollTop < 0 && posX - scrollTop + height > 0) {
45            //updateUrl($this.data('url'));
46            //return false;
47            //}
48            //});
49        };
50
51        var goToPage = function (url) {
52
53            var $page = $('.section[data-url="' + url +  '"]');
54
55            if ($page.size() === 0) {
56                return false; 
57            }
58
59            scrollCallbacks.remove(onScroll); 
60
61            $('html, body').animate({
62                scrollTop: parseInt($page.offset().top - $('#header').height())
63            }, 2000, function () {
64                scrollCallbacks.add(onScroll);
65            });
66
67            updateUrl(url);
68        };
69
70        var url = window.location.href;
71
72        if (url != window.siteUrl + '/') {
73            goToPage(url);
74        }
75
76        $('#header .nav a').not($('#header .nav .fb a')).click(function (e) {
77            e.preventDefault(); 
78            goToPage($(this).attr('href'));
79        });
80
81        $('.section').each(function() {
82            var $this = $(this);
83            $this.data('posX', $this.offset().top) ;
84            $this.data('height', $this.outerHeight()) ;
85        });
86
87        scrollCallbacks.add(onScroll); 
88
89    })();
90
91    // Header
92    (function () {
93
94        var getOffset = function ($element) {
95            if ($element.size() === 0) {
96                return false; 
97            }
98            return $element.offset().top - $(window).scrollTop();
99        };
100
101
102        $('.mobile-open').click(function(){
103            $(this).parent().toggleClass('min');
104        });
105
106
107        var $header = $('#header');
108        var originalOffset = getOffset($header);
109        var top = $header.css('top');
110        var width = $header.width();
111
112        scrollCallbacks.add(function () {
113
114            if ( $(window).width() > 770) {
115
116                var offset = getOffset($header);
117                if (offset < 0) {
118                    $header.css({
119                        position: 'fixed',
120                        top: 0,
121                        margin: 0
122                    }); 
123                    scrollTop = $(window).scrollTop();
124                } else if ($(window).scrollTop() < originalOffset) {
125                    $header.css({
126                        position: 'absolute',
127                        top: '50%',
128                        marginTop: "-60px"
129                    });
130                }
131
132            } else {
133
134                if ($(window).scrollTop() >= 30) {
135                    $header.addClass('min');
136                } 
137
138                $header.css({
139                    position: 'fixed',
140                    top: 0,
141                    margin: 0
142                });
143
144            }
145
146        });
147
148    })();
149
150    // Notification
151    (function () {
152
153        var $notification = $('#notification');
154        var $close        = $notification.find('.close');
155
156        $close.click(function (e) {
157            e.preventDefault();
158            if ($notification.data('open')) {
159                $notification.removeClass('open'); 
160                $notification.data('open', false); 
161            } else {
162                 $notification.addClass('open'); 
163                $notification.data('open', true); 
164            }
165        }); 
166
167    })();
168
169    // Columns
170    (function () {
171
172        if (!Modernizr.csscolumns) {
173            $('#section-2').find('.content').columnize({
174                columns: 2 
175            });
176        }
177
178    })();
179
180    // Tabs
181    (function () {
182
183        var $container = $('.tab-container');
184        var $tabs = $container.find('.tabs');
185        var $panes = $container.find('.pane');
186        var activeClass = 'active';
187
188        $tabs.find('a').click(function(e) {
189            e.preventDefault();
190            var $this = $(this);
191            var $parentsLi = $this.parents('li');
192
193            if(!$parentsLi.hasClass(activeClass)) {
194                $tabs.find('li').removeClass(activeClass);
195                $panes.hide();
196                var target = $(this).attr('href');
197                $parentsLi.addClass(activeClass);
198                $container.find(target).show();
199            }	
200        });
201
202        $panes.not(':first').hide();
203        $tabs.find('li:first').addClass(activeClass);
204
205    })();
206
207    // Mosaic
208    (function () {
209
210        $('#mosaic').magnificPopup({
211            delegate: 'a',
212            type: 'image',
213            tClose: 'Fermer',
214            gallery: {
215                enabled: true,
216                tPrev: 'Précédent',
217                tNext: 'Suivant',
218                tCounter: ''
219            }
220        }); 
221
222    })();
223
224
225    var $map = $('#map-canvas');
226    var map;
227    mapboxgl.accessToken = 'pk.eyJ1Ijoid29raW5lIiwiYSI6ImNtMWdtajJnbTA1eWIya3M4ZnJyaHFlOXEifQ.k3Cp-Ce1xJbSlkWFybJGjQ';
228    address = $map.data('address');
229    var	position = [address.long, address.lat];
230
231    // Google map
232    (function() {
233
234
235        if ($map.size() === 0) {
236            return; 
237        }
238
239        map = new mapboxgl.Map({
240            container: 'map-canvas',
241            style: 'mapbox://styles/mapbox/streets-v12',
242            zoom: 17,
243            center: position,
244        });
245
246        map.scrollZoom.disable();
247        map.addControl(new mapboxgl.NavigationControl());
248
249        const popup = new mapboxgl.Popup().setHTML(
250            $('#info-window').html()
251        );
252
253        const el = document.createElement('div');
254        el.className = 'marker';
255        const marker = new mapboxgl.Marker(el)
256        .setLngLat(position)
257        .setPopup(popup)
258        .addTo(map);
259
260        /* map = new google.maps.Map(document.getElementById('map-canvas'), {
261            center: position,
262            zoom: 17,
263            mapTypeId: google.maps.MapTypeId.ROADMAP,
264            disableDefaultUI: true,
265            scrollwheel:false,
266            zoomControl: true,
267            zoomControlOptions: {
268                style: google.maps.ZoomControlStyle.SMALL,
269                position: google.maps.ControlPosition.TOP_RIGHT
270            },
271            styles: [
272                {
273                "stylers": [
274                    { "hue": "#da7b6b" },
275                    { "invert_lightness": true },
276                    { "saturation": 50 },
277                    { "gamma": 2 },
278                    { "lightness": 60 },
279                    { "visibility": "on" }
280                ]
281            }
282            ]
283        });
284
285        var markerImage = new google.maps.MarkerImage(address.markerImage, null, null, null, new google.maps.Size(43, 63));
286        var markerShadow = new google.maps.MarkerImage(address.markerShadow, null, null, null, new google.maps.Size(100,35));
287
288        var marker = new google.maps.Marker({
289            map: map,
290            position: position,
291            title: address.title,
292            animation: google.maps.Animation.DROP,
293            icon: markerImage,
294            shadow: markerShadow,
295            optimized: false
296        });
297
298        var infoWindow = new google.maps.InfoWindow({
299            map: map,
300            position: position,
301            content: $('#info-window').html()
302        });
303
304        infoWindow.close();
305
306        google.maps.event.addListener(marker, 'click', function () {
307            infoWindow.open(map, marker);
308        });*/
309
310    })();   
311
312    // Scroll callbacks
313    (function () {
314
315        var didScroll = false;
316
317        $(window).scroll(function() {
318            didScroll = true;
319        });
320
321        setInterval(function() {
322            if (didScroll) {
323                didScroll = false;
324                scrollCallbacks.fire();
325            }
326        }, 100);
327
328    })();
329
330
331    var wH = $(window).height();
332
333    $(window).resize(function(){
334
335        var wH = $(window).height();
336        $("#section-1").css({height:wH});
337        scrollCallbacks.fire();
338
339        /* if ( $(window).width() <= 770) {
340            map.set('draggable', false);
341        } else {
342            map.set('draggable', true);
343        } */
344
345        // map.setCenter(position);
346
347    });
348
349    $(window).trigger("resize");
350
351
352
353});

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.