'hidden'); $('.popup').toggle(); } // search function; var searchFunc = function(path, search_id, content_id) { 'use strict'; $.ajax({ url: path, dataType: "xml", async: true, success: function( xmlResponse ) { // get the contents from search data isfetched = true; $('.popup').detach().appendTo('.header-inner'); var datas = $( "entry", xmlResponse ).map(function() { return { title: $( "title", this ).text(), content: $("content",this).text(), url: $( "url" , this).text() }; }).get(); var $input = document.getElementById(search_id); var $resultContent = document.getElementById(content_id); $input.addEventListener('input', function(){ var matchcounts = 0; var str='"; if (matchcounts == 0) { str = '
' } if (keywords == "") { str = '
' } $resultContent.innerHTML = str; }); proceedsearch(); } });} // handle and trigger popup window; $('.popup-trigger').click(function(e) { e.stopPropagation(); if (isfetched == false) { searchFunc(path, 'local-search-input', 'local-search-result'); } else { proceedsearch(); }; }); $('.popup-btn-close').click(function(e){ $('.popup').hide(); $(".popoverlay").remove(); $('body').css('overflow', ''); }); $('.popup').click(function(e){ e.stopPropagation(); });