1 2(function($) { 3 Drupal.behaviors.ssks_menu_mobile = { 4 initOk: false, 5 6 attach: function(context, settings) { 7 8 // eviter le rappel via AJAX 9 if (Drupal.behaviors.ssks_menu_mobile.initOk) return; 10 Drupal.behaviors.ssks_menu_mobile.initOk = true; 11 12 Drupal.behaviors.ssks_menu_mobile.menuMobile(); 13 }, 14 15 /*--------------------------------------------------------------------- 16 :: MENU MOBILE 17 -------------------------------------------------------------------*/ 18 menuMobile: function() { 19 20 // TOUS LES LIENS OU INPUT DU MENU MOBILE 21 var links = $('#menu-mobile-container').find('a:not(.deplier-bouton), input'); 22 23 links.each(function(){ 24 $(this).focus(function(){ 25 openMenu(); 26 }) 27 }); 28 29 // OUVERTURE DU MENU 30 function openMenu() { 31 if ($('#menu-mobile-container').hasClass('cbp-spmenu-open')) return; 32 33 $('#menu-mobile-bouton').addClass('active'); 34 $('body').addClass('cbp-spmenu-push-toright'); 35 $('#menu-mobile-container').addClass('cbp-spmenu-open'); 36 37 // focus sur le premier input ou lien 38 setTimeout(function(){ 39 $(links[0]).focus(); 40 }, 20); 41 } 42 43 44 // FERMETURE DU MENU 45 function closeMenu() { 46 $('#menu-mobile-bouton').removeClass('active'); 47 $('body').removeClass('cbp-spmenu-push-toleft cbp-spmenu-push-toright' ); 48 $('.cbp-spmenu-open').removeClass('cbp-spmenu-open' ); 49 } 50 51 52 // click toggle menu bouton 53 $('#menu-mobile-bouton').on('click', function(event) { 54 55 if ( $(this).hasClass('active')){ 56 closeMenu(); 57 } else { 58 openMenu(); 59 } 60 event.stopPropagation(); 61 }); 62 63 // Replie menu mobile au clic sur le container du site 64 $('.overlay-mobile, #menu-mobile-close-bouton').on("click", function(){ 65 closeMenu(); 66 $('#menu-mobile-bouton').focus(); 67 }); 68 69 // Stop la propagation du clic pour éviter le repli du menu mobile 70 $('#menu-mobile-container').on('click', function(event) { 71 event.stopPropagation(); 72 }); 73 74 // Ferme le menu quand on "echap" 75 $(document).unbind('keyup').keyup(function(e) { 76 if (e.keyCode == 27) { // escape key maps to keycode `27` 77 closeMenu(); 78 $('#menu-mobile-bouton').focus(); 79 } 80 }); 81 82 // Ferme le menu FOCUS SUR UN LIEN HORS MENU 83 $('a:not(#menu-mobile-bouton), button:not(#menu-mobile-bouton), input').on('focus', function(){ 84 85 if($(this).closest('#menu-mobile-container').length == 0 ){ 86 closeMenu(); 87 } 88 89 }); 90 91 // Initialise le sous menu et l'actif sur le bouton déplié si la rubrique est active 92 $('.menu-mobile li.active ul ').show(); 93 $('.menu-mobile li.active .deplier-bouton').addClass('active'); 94 95 // Bouton deplie le sous menu mobile 96 $('.deplier-bouton').each(function() { 97 if ($(this).closest('li').children('ul').length > 0) { 98 99 $(this).click(function() { 100 $(this).toggleClass('active'); 101 $(this).closest('li').children('ul').slideToggle(); 102 return false; 103 }); 104 105 } else { 106 $(this).hide(); 107 } 108 109 }); 110 } 111 } 112})(jQuery) ;
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.