1jQuery(document).ready(function($){ 2 //if you change this breakpoint in the style.css file (or _layout.scss if you use SASS), don't forget to update this value as well 3 var MqL = 1170; 4 //move nav element position according to window width 5 moveNavigation(); 6 $(window).on('resize', function(){ 7 (!window.requestAnimationFrame) ? setTimeout(moveNavigation, 300) : window.requestAnimationFrame(moveNavigation); 8 }); 9 10 //mobile - open lateral menu clicking on the menu icon 11 $('.cd-nav-trigger').on('click', function(event){ 12 event.preventDefault(); 13 if( $('.cd-main-content').hasClass('nav-is-visible') ) { 14 closeNav(); 15 $('.cd-overlay').removeClass('is-visible'); 16 } else { 17 $(this).addClass('nav-is-visible'); 18 $('.cd-main-header').addClass('nav-is-visible'); 19 $('.cd-main-content').addClass('nav-is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){ 20 $('body').addClass('overflow-hidden'); 21 }); 22 toggleSearch('close'); 23 $('.cd-overlay').addClass('is-visible'); 24 } 25 }); 26 27 //open search form 28 $('.cd-search-trigger').on('click', function(event){ 29 event.preventDefault(); 30 toggleSearch(); 31 closeNav(); 32 }); 33 34 35 36 37 38 39 40 41 //submenu items - go back link 42 $('.go-back').on('click', function(){ 43 $(this).parent('ul').addClass('is-hidden').parent('.has-children').parent('ul').removeClass('moves-out'); 44 }); 45 46 function closeNav() { 47 $('.cd-nav-trigger').removeClass('nav-is-visible'); 48 $('.cd-main-header').removeClass('nav-is-visible'); 49 $('.cd-primary-nav').removeClass('nav-is-visible'); 50 $('.has-children ul').addClass('is-hidden'); 51 $('.has-children a').removeClass('selected'); 52 $('.moves-out').removeClass('moves-out'); 53 $('.cd-main-content').removeClass('nav-is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){ 54 $('body').removeClass('overflow-hidden'); 55 }); 56 } 57 58 function toggleSearch(type) { 59 if(type=="close") { 60 //close serach 61 $('.cd-search').removeClass('is-visible'); 62 $('.cd-search-trigger').removeClass('search-is-visible'); 63 $('.cd-overlay').removeClass('search-is-visible'); 64 } else { 65 //toggle search visibility 66 $('.cd-search').toggleClass('is-visible'); 67 $('.cd-search-trigger').toggleClass('search-is-visible'); 68 $('.cd-overlay').toggleClass('search-is-visible'); 69 if($(window).width() > MqL && $('.cd-search').hasClass('is-visible')) $('.cd-search').find('input[type="search"]').focus(); 70 ($('.cd-search').hasClass('is-visible')) ? $('.cd-overlay').addClass('is-visible') : $('.cd-overlay').removeClass('is-visible') ; 71 } 72 } 73 74 function checkWindowWidth() { 75 //check window width (scrollbar included) 76 var e = window, 77 a = 'inner'; 78 if (!('innerWidth' in window )) { 79 a = 'client'; 80 e = document.documentElement || document.body; 81 } 82 if ( e[ a+'Width' ] >= MqL ) { 83 return true; 84 } else { 85 return false; 86 } 87 } 88 89 function moveNavigation(){ 90 var navigation = $('.cd-nav'); 91 var desktop = checkWindowWidth(); 92 if ( desktop ) { 93 navigation.detach(); 94 navigation.insertBefore('.cd-header-buttons'); 95 } else { 96 navigation.detach(); 97 navigation.insertAfter('.cd-main-content'); 98 } 99 } 100});
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.