1/** 2 * main.js 3 * http://www.codrops.com 4 * 5 * Licensed under the MIT license. 6 * http://www.opensource.org/licenses/mit-license.php 7 * 8 * Copyright 2016, Codrops 9 * http://www.codrops.com 10 */ 11;(function(window) { 12 13 'use strict'; 14 15 var openCtrl = document.getElementById('btn-search'), 16 openCtrlMobile = document.getElementById('btn-search-mobile'), 17 closeCtrl = document.getElementById('btn-search-close'), 18 searchContainer = document.querySelector('.search-bar'), 19 inputSearch = searchContainer.querySelector('.search__input'); 20 21 function init() { 22 initEvents(); 23 } 24 25 function initEvents() { 26 openCtrl.addEventListener('click', openSearch); 27 openCtrlMobile.addEventListener('click', openSearch); 28 closeCtrl.addEventListener('click', closeSearch); 29 document.addEventListener('keyup', function(ev) { 30 // escape key. 31 if( ev.keyCode == 27 ) { 32 closeSearch(); 33 } 34 }); 35 } 36 37 function openSearch() { 38 searchContainer.classList.add('search--open'); 39 inputSearch.focus(); 40 41 } 42 43 function closeSearch() { 44 searchContainer.classList.remove('search--open'); 45 inputSearch.blur(); 46 inputSearch.value = ''; 47//**Will need the line below if dlmenu can close by clicking outside menu 48//** that feature is currently off 49 50 // The Lines below removes all classes need to keep mobile menu open 51 // this will prevent problems that stop mobile menu from open properly 52 // $('#dl-menu').dlmenu("closeMenu"); 53 // $('#overlay').removeClass('show'); 54 // $('html').removeClass("active-mobile-menu"); 55 // $("body").removeClass("modal-open") 56 } 57 58 init(); 59 60})(window);
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.