PageSourceSearch

https://www.pikler.fr/sites/themes/bzhd/js/menu/main.js?ver=7.1.2

js pikler.fr collected 2026-09-24 20:54:37 UTC 3,420 bytes, 98 lines download raw bytes

1jQuery(document).ready(function($){
2	//open/close mega-navigation
3	$('.cd-dropdown-trigger').on('click', function(event){
4		event.preventDefault();
5		toggleNav();
6	});
7
8	//close meganavigation
9	$('.cd-dropdown .cd-close, .cd-dropdown .bzhdanchor').on('click', function(event){
10		event.preventDefault();
11		toggleNav();
12	});
13
14	//on mobile - open submenu
15	$('.has-children').children('a').on('click', function(event){
16		//prevent default clicking on direct children of .has-children
17		var selected = $(this);
18
19		if(($(window).width() <1024)){
20			event.preventDefault();
21			selected.next('ul').removeClass('is-hidden').end().parent('.has-children').parent('ul').addClass('move-out');
22
23		}else {
24			if (selected.next('ul').hasClass('bzhd-hidden-hover')) {
25				return;
26			} else {
27				selected.next('ul').removeClass('is-hidden').end().parent('.has-children').parent('ul').addClass('move-out');
28			}
29		}
30	});
31
32
33	//on desktop - differentiate between a user trying to hover over a dropdown item vs trying to navigate into a submenu's contents
34	var submenuDirection = ( !$('.cd-dropdown-wrapper').hasClass('open-to-left') ) ? 'right' : 'left';
35	$('.cd-dropdown-content').menuAim({
36		activate: function(row) {
37			$(row).children().addClass('is-active').removeClass('fade-out');
38			if( $('.cd-dropdown-content .fade-in').length == 0 ) $(row).children('ul').addClass('fade-in');
39		},
40		deactivate: function(row) {
41			$(row).children().removeClass('is-active');
42			if( $('li.has-children:hover').length == 0 || $('li.has-children:hover').is($(row)) ) {
43				$('.cd-dropdown-content').find('.fade-in').removeClass('fade-in');
44				$(row).children('ul').addClass('fade-out')
45			}
46		},
47		exitMenu: function() {
48			$('.cd-dropdown-content').find('.is-active').removeClass('is-active');
49			return true;
50		},
51		submenuDirection: submenuDirection,
52	});
53
54	//submenu items - go back link
55	$('.go-back').on('click', function(){
56		var selected = $(this),
57			visibleNav = $(this).parent('ul').parent('.has-children').parent('ul');
58		selected.parent('ul').addClass('is-hidden').parent('.has-children').parent('ul').removeClass('move-out');
59	});
60
61	function toggleNav(){
62		var navIsVisible = ( !$('.cd-dropdown').hasClass('dropdown-is-active') ) ? true : false;
63		$('.cd-dropdown').toggleClass('dropdown-is-active', navIsVisible);
64		$('.cd-dropdown-trigger').toggleClass('dropdown-is-active', navIsVisible);
65		if( !navIsVisible ) {
66			$('.cd-dropdown').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend',function(){
67				if (('ul.sous-group')) return; //test bzhd
68				$('.has-children ul').addClass('is-hidden');
69				$('.move-out').removeClass('move-out');
70				$('.is-active').removeClass('is-active');
71			});
72		}
73	}
74
75	//IE9 placeholder fallback
76	//credits http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html
77	if(!Modernizr.input.placeholder){
78		$('[placeholder]').focus(function() {
79			var input = $(this);
80			if (input.val() == input.attr('placeholder')) {
81				input.val('');
82			}
83		}).blur(function() {
84			var input = $(this);
85			if (input.val() == '' || input.val() == input.attr('placeholder')) {
86				input.val(input.attr('placeholder'));
87			}
88		}).blur();
89		$('[placeholder]').parents('form').submit(function() {
90			$(this).find('[placeholder]').each(function() {
91				var input = $(this);
92				if (input.val() == input.attr('placeholder')) {
93					input.val('');
94				}
95			})
96		});
97	}
98});

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.