PageSourceSearch

https://www.chavagne.fr/wp-content/themes/chavagne/js/scripts.js

js chavagne.fr collected 2026-10-02 12:32:23 UTC 8,829 bytes, 316 lines download raw bytes

1jQuery(function($) {
2
3	// Menu Site
4 // -------------------------------------------------------------------
5
6 // Menu responsive
7 
8 // Séparer les li en deux ul de chaque sub-menu
9 $('.sub-menu').each(function(){
10  
11  var count_li = $(this).children('ul.bloc-menu-left').children('li').length;
12  var moitier_count_li = count_li/2;
13  for (i = count_li-1; i > Math.round(moitier_count_li-1); i--){
14   $(this).children('ul.bloc-menu-right').prepend($(this).children('ul.bloc-menu-left').children('li').eq(i));
15  };
16
17  $(this).appendTo($(this).prev('li'));
18 })
19
20 $('.toggleMenu').click(function() {
21  if($(window).width() > 1260){
22   $('.menu-menu-principal-container').animate({width:'toggle'}, 600);
23  } else {
24   if($('.menu-menu-principal-container').css('display') == 'none'){
25    $('.menu-menu-principal-container').css('display','block');
26    $('.overlay-menu').css('display','block');
27   } else {
28    $('.menu-menu-principal-container').css('display','none');
29    $('.overlay-menu').css('display','none');
30   }
31  }
32 });
33
34
35 if($(window).width() <= 1260){
36  $('header .main-menu > li.menu-item-has-children > a').click(function(){
37   $('header .main-menu > li.menu-item-has-children .sub-menu').css("display","none");
38   if($(this).next('.sub-menu').css("display") == "block"){
39    $(this).next('.sub-menu').css("display","none");
40   } else {
41    $(this).next('.sub-menu').css("display","block");
42   }
43   return false;
44  });
45 }
46
47
48	
49
50	//Sticky Menu
51    if($(window).width() > 1240){
52        $(window).scroll(function (event) {
53            var y = $(this).scrollTop(); 
54            if ($( "body" ).hasClass( "home" )) {
55                if (y >= 530) {
56                  $('header .bottom-header').addClass('fixed');
57                } else {
58                  $('header .bottom-header').removeClass('fixed');
59                }
60            }
61            else {
62                if (y >= 270) {
63                  $('header .bottom-header').addClass('fixed');
64                } else {
65                  $('header .bottom-header').removeClass('fixed');
66                }
67            }           
68        });
69    }
70
71
72		// Recherche
73		$('header .bottom-header .outils-menu .toggle-search').click(function() {
74			
75
76			// var value_input = $('header .top-header .menu-wrapper .search-wrapper input[type=text]').val();
77
78			// if(value_input == '' || value_input == undefined || value_input == 'Rechercher') {
79				setTimeout(function(){$('header .bottom-header .search-wrapper input[type=text]').focus();}, 200);
80				$('header .bottom-header .search-wrapper').animate({height:'toggle'}, 600);
81			// 	return false;
82			// } else {
83			// 	$('header .top-header .menu-wrapper .search-wrapper form button').trigger('click');
84			// }
85		})
86	// -------------------------------------------------------------------------
87
88	// Modifs site
89	// -------------------------------------------------------------------------
90	
91	$(window).ready(function(){
92		if($(document).width() > 1240){
93			var primary = $('#primary').outerHeight(true);
94			var secondary = $('#secondary').outerHeight(true);
95
96			if(secondary > primary){
97				$('#primary').css('height', secondary+'px');
98			}
99		}
100	})
101
102	$(window).ready(function(){
103		$('header .top-header .menu-wrapper .utilitaires-header li a').click(function(){
104			var el = $('header .utilitaires-accessibar-div');
105			if($(this).parent().hasClass('traduction-icon')){
106				if(el.hasClass('hover-utilitaire')){
107					el.removeClass('hover-utilitaire');
108				} else {
109					el.removeClass('hover-accessibar');
110					el.addClass('hover-utilitaire');
111				}
112			} else if($(this).parent().hasClass('accessibar-icon')){
113				if(el.hasClass('hover-accessibar')){
114					el.removeClass('hover-accessibar');
115				} else {
116					el.removeClass('hover-utilitaire');
117					el.addClass('hover-accessibar');
118				}
119			}
120
121			return false;
122		})
123 
124		// Comarquage
125		if($('body').hasClass('home')){
126			$('.front-page .fil-infos-droits-demarches .droits-demarches-ligne button.valider-droits').click(function(){
127				var val = $('.front-page .fil-infos-droits-demarches .droits-demarches-ligne select').val();
128				window.location.assign(val);
129			})
130		}
131
132		// Au hover sur l'image en JPG
133		$('a.carte-non-svg').hover(function(){
134			$('.carte-svg').css('display','block');
135			$('.overlay-carte-interactive').css('display','block');
136		})
137
138		// Au hover sur l'overlay
139		$('.overlay-carte-interactive').hover(function(){
140			$(this).css('display','none');
141			$('.carte-svg').css('display','none');
142		})
143
144		// Au hover sur les différentes villes (SVG)
145		$('.ville-presente-cc a').hover(function(){
146			var ville = $(this).attr('class');
147			$('.carte-svg svg a.'+ville+' polygon').attr('class','hoverland');
148		}, function(){
149			$('.carte-svg svg a polygon').removeAttr('class');
150		})
151
152		// Au click sur les différentes villes (SVG)
153		$('.carte-svg svg a').click(function(){
154			var ville = $(this).attr('class');
155			var lien = $('.ville-presente-cc a.'+ville).attr('href');
156			window.location.href = lien;
157			return false;
158		})
159
160		// Au hover sur les différentes villes (Text)
161		$('.carte-svg svg a').hover(function(){
162			var ville = $(this).attr('class');
163			$('.ville-presente-cc a.'+ville).addClass('hoverlandtwo');
164		}, function(){
165			$('.ville-presente-cc a').removeClass('hoverlandtwo');
166		})
167		
168	});
169
170
171	// Accessibar
172	// ----------------------------------------------------------------
173
174
175	// Scripts slider
176	// ----------------------------------------------------------------
177
178	if($('body').hasClass('home')){
179
180		$(".bandeau-publication .wrapper-slider-home").carouFredSel({
181			responsive: true,
182			width: 880,
183			height: 530,
184			circular: true,
185			auto: 10000, //20000
186			items: {
187				visible: 1
188			},
189			scroll: {
190				fx: "crossfade",
191				easing : "cubic",
192				duration: 800 //800
193			},
194			prev: {
195			    button: ".bandeau-publication a.prev",
196			    key: "left"
197			},
198			next: {
199				button: ".bandeau-publication a.next",
200				key: "right"
201			}
202		});
203
204		$(".nav-next").click(function() { 
205			$(".bandeau-publication .wrapper-slider-home").trigger( "next" ); 
206		});
207		$(".nav-prev").click(function() { 
208			$(".bandeau-publication .wrapper-slider-home").trigger( "prev" ); 
209		});
210
211        
212
213        if($(window).width() < 940) {
214            var heightActu = 250;
215            var directionActu = 'up';
216        }
217        if($(window).width() > 939){
218            var heightActu = 250;
219            var widthActu = 480;
220            var directionActu = 'up';
221        }
222        if($(window).width() < 581){
223            var heightActu = 458;
224            var widthActu = 300;
225            var directionActu = 'right';
226        }
227        //actus
228        $(".wrapper-actualite-description ul").carouFredSel({
229			responsive: true,
230			width: widthActu,
231			height: heightActu,
232			circular: true,
233			auto: 80000, //8000
234			direction: directionActu,
235			items: {
236				visible: 1
237			},
238			scroll: {
239				fx: "scroll",
240				easing : "quadratic",
241				duration: 700,
242				onBefore : function(data){
243					$(this).trigger("currentPosition", function( pos ) {
244						$('.item-liste-actus a').removeClass('selected');
245						$('.item-liste-actus a').removeClass('active');
246						$('.item-liste-actus a').eq(pos).addClass('selected');
247					});
248				}
249			},
250		});
251               
252
253
254		$('.item-liste-actus a').click(function(){
255			var slideNum = $(this).data('slide');
256			$('.wrapper-actualite-description ul').trigger('slideTo', slideNum);
257			return false;
258		});
259
260
261	}
262
263
264
265
266	// Responsive Iframe Videos
267
268	jQuery( ".entry-content iframe").each(function(){
269		var src = jQuery(this).attr('src');
270		var youtube_str = src.indexOf("youtube");
271		var dailymotion_str= src.indexOf("dailymotion");
272		var vimeo_str = src.indexOf("vimeo");
273
274		if(youtube_str > 0 || dailymotion_str > 0 || vimeo_str > 0){
275			jQuery(this).wrap("<div class='video-container'></div>");
276		}
277	});
278
279	 // Modif html Home
280
281	 if($(window).width() <= 940) {
282	 	$('.front-page .evt-outils-pratiques .outils-pratiques').insertAfter(".front-page .fil-infos-droits-demarches .fil-infos");
283	 	$('.single .infos-profil').insertBefore(".single .zoom-sur");
284	 }
285
286	// Bouton top (haut de page)
287	// ----------------------------------------------------------------
288
289	if($(window).width() > 580){
290		$('.scroll-top').click(function() {
291			$('html,body').animate({scrollTop: 0}, 'slow');
292		});
293
294		$(window).scroll(function(){
295			if($(window).scrollTop()<100){
296				$('.scroll-top').fadeOut();
297			}else{
298				$('.scroll-top').fadeIn();
299			}
300		});
301	}
302
303	
304
305	// Variable global pour les propositions de publication
306	// ----------------------------------------------------------------
307	if($(window).width() >= 1240)	heightProp = 500;
308	else if($(window).width() >= 940 && $(window).width() < 1240)	heightProp = 500;
309	else if($(window).width() >= 580 && $(window).width() < 940)	heightProp = 345;
310	else if($(window).width() < 580)	heightProp = 414;
311
312
313});
314
315
316

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.