1// Custom Header - Search Form 2 jQuery(document).ready( function($){ 3 4 5 $( '#custom-header' ).append( custom_header_search_data.search_form ); 6 7 // Mobile Search Icon 8 $( '.et_mobile_nav_menu' ).ready( function() { 9 $( '.et_mobile_nav_menu' ).append( 10 '<div id="jswj_mobile_search_icon_wrapper">' 11 + '<span class="jswj_menu_search_icon"><a href="#"><i class="fa fa-search" aria-hidden="true"></i></a></span>' 12 + '</div>' 13 ); 14 15 $( '.et_mobile_nav_menu .jswj_menu_search_icon' ).click( function(event) { 16 event.preventDefault(); 17 jswj_show_search_form(); 18 }); 19 20 }); 21 22 $( '.fullwidth-menu-nav ul' ).append( 23 '<li class="jswj_menu_search_icon menu-item menu-item-type-custom menu-item-object-custom">' 24 + '<a href="#"><i class="fa fa-search" aria-hidden="true"></i></a></li>' 25 ); 26 27 //Show Search Form When Clicking Search Icon 28 $( '.jswj_menu_search_icon' ).click( function(event) { 29 event.preventDefault(); 30 jswj_show_search_form(); 31 }); 32 33 function jswj_show_search_form() { 34 $( '.jswj_menu_search_icon' ).parents('#custom-header').addClass('jswj_is_searching'); 35 36 var $search_container = $( '.jswj_custom_header_search_form_container' ); 37 if ( $search_container.hasClass('et_pb_is_animating') ) { return; } 38 $search_container.removeClass( 'et_pb_search_form_hidden et_pb_no_animation' ).addClass('et_pb_search_visible et_pb_is_animating'); 39 setTimeout( function() { 40 $search_container.addClass( 'et_pb_no_animation' ).removeClass('et_pb_is_animating'); 41 $( '.jswj_custom_header_search_form_container' ).css('opacity','1'); 42 }, 1000); 43 $search_container.find( 'input' ).focus(); 44 jswj_set_search_form_css(); 45 } 46 47 function jswj_hide_search_form() { 48 if ( $( '.jswj_custom_header_search_form_container' ).hasClass('et_pb_is_animating') ) { 49 return; } 50 if ( ! $( '.jswj_custom_header_search_form_container' ).hasClass('et_pb_search_visible') ) { return; } 51 52 $( '.jswj_custom_header_search_form_container' ).removeClass('et_pb_search_visible et_pb_no_animation' ).addClass( 'et_pb_search_form_hidden et_pb_is_animating' ); 53 setTimeout( function() { 54 $( '.jswj_custom_header_search_form_container' ).addClass( 'et_pb_no_animation' ).removeClass('et_pb_is_animating'); 55 $( '.jswj_custom_header_search_form_container' ).css('opacity','0'); 56 $( '.jswj_custom_header_search_form_container' ).css('z-index','0'); 57 }, 1000); 58 59 $( '.jswj_menu_search_icon' ).parents('#custom-header').removeClass('jswj_is_searching'); 60 } 61 62 function jswj_set_search_form_css() { 63 var $search_container = $( '.jswj_custom_header_search_form_container' ); 64 var $body = $( 'body' ); 65 if ( $search_container.hasClass( 'et_pb_search_visible' ) ) { 66 var header_height = $( '#custom-header' ).innerHeight(), 67 menu_width = $( '#top-menu' ).width(), 68 font_size = $( '#top-menu li a' ).css( 'font-size' ); 69 $search_container.find( 'input' ).css( 'font-size', font_size ); 70 } 71 } 72 73 // Hide Search Form When Clicking Close Icon 74 $( '.jswj_custom_header_search_field_close' ).click( function() { 75 jswj_hide_search_form(); 76 }); 77 78 // Hide Search Form When Clicking Elsewhere 79 $( document ).mouseup( function(e) { 80 var $header = $( '#custom-header' ); 81 if ( ! $header.is( e.target ) && $header.has( e.target ).length === 0 ) { 82 jswj_hide_search_form(); } 83 }); 84 85 });
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.