1/** 2 * Main theme specific javascript file. 3 */ 4 5( function( $ ) { 6 7 'use strict'; 8 $( document ).ready( function() { 9 10 // On dom ready hide the scroll up button. 11 $( '#scroll-up' ).hide(); 12 13 // Toggle display of site preloader. 14 if ( friendly_lite_js_obj.site_preloader ) { 15 16 const pre_loader = function() { 17 $( '.pre-loader' ).fadeOut( 'slow' ); 18 }; 19 20 // Call a preloader. 21 pre_loader(); 22 } 23 24 // Toggle collapsible button icon. 25 $( '#topbar-wrapper' ).on( 'hide.bs.collapse', function() { 26 $( '#toggle-topbar>.fa' ).removeClass( 'fa-angle-up' ).addClass( 'fa-angle-down' ); 27 } ); 28 29 $( '#topbar-wrapper' ).on( 'show.bs.collapse', function() { 30 $( '#toggle-topbar>.fa' ).removeClass( 'fa-angle-down' ).addClass( 'fa-angle-up' ); 31 } ); 32 33 // Show/hide scroll up button. 34 $( window ).scroll( function () { 35 // reset nav offset on scroll when window gets resize 36 if ( $( this ).scrollTop() >= 100 ) { 37 $( '#scroll-up' ).show(); 38 } else { 39 $( '#scroll-up' ).hide(); 40 } 41 } ); 42 43 // Scroll the page upwards. 44 $( '#scroll-up' ).on( 'click', function() { 45 $( 'body, html' ).stop( false, false ).animate( { 46 scrollTop: 0 47 }, 800 ); 48 return false; 49 } ); 50 51 // Handle sticky nav on window resize. 52 $( window ).resize( function() { 53 $.fn.toggleBsNbBehaviour(); 54 55 // Toggle of top bar. 56 $.fn.toggleTopBar(); 57 } ); 58 59 // Change submenu dropdown menu item as per window size. 60 $.fn.toggleBsNbBehaviour = function() { 61 if ( $( window ).width() > 991 ) { 62 $( '.sub-menu' ).removeAttr( 'style' ); 63 $( '.toggle-submenu' ).remove(); 64 } else if ( $( window ).width() < 992 ) { 65 if ( ! $( '.menu-item-has-children' ).has( '.toggle-submenu' ).length ) { 66 $( '.menu-item-has-children' ).append( '<button class="dropdown-toggle toggle-submenu"><span class="screen-reader-text">Expand Menu</span></button>' ); 67 } 68 } 69 } 70 71 // Toggles top bar. 72 $.fn.toggleTopBar = function() { 73 74 // Hide quick links top bar below 620px. 75 if ( $( window ).width() < 600 ) { 76 77 // Hide only if the top bar is visible. 78 if ( $( '#topbar-wrapper' ).hasClass( 'in' ) ) { 79 $( '#topbar-wrapper' ).collapse( 'hide' ); 80 } 81 } else { 82 83 // Show top bar only if that is hidden. 84 if ( ! $( '#topbar-wrapper' ).hasClass( 'in' ) ) { 85 $( '#topbar-wrapper' ).collapse( 'show' ); 86 } 87 } 88 } 89 90 $.fn.toggleTopBar(); 91 $.fn.toggleBsNbBehaviour(); 92 93 // Slide up and slide down sub menus on small devices. 94 $( '.menu-item-has-children' ).on( 'click', ' > .toggle-submenu', function( e ) { 95 $( this ).toggleClass( 'toggle-in' ); 96 $( this ).parent().children( '.sub-menu' ).toggle(); 97 } ); 98 99 } ); 100} )( 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.