PageSourceSearch

https://ztresearch.blog/wp-content/themes/rowling/js/global.js?ver=20180502

js ztresearch.blog collected 2026-10-02 22:04:48 UTC 2,581 bytes, 112 lines download raw bytes

1/**
2 * global.js
3 *
4 * Handles various UI actions
5 * - Mobile menu
6 * - Search form show/hide
7 * - Touch device dropdowns (requires: doubletaptogo.js)
8 * - Flexslider (requires: flexslider.js)
9 * - Scroll to top
10 * - Smooth page load
11 *
12 * @package Rowling
13 */
14( function( $ ) {
15
16/**
17 * On ready
18 */
19	$( document ).ready( function() {
20		var windowWidth = $( window ).width();
21
22
23		// Toggle mobile menu
24		$( ".nav-toggle" ).on( "click", function() {
25			$( this ).toggleClass( "active" );
26			$( ".header-bottom-menu" ).slideToggle();
27			if ( $( ".search-toggle" ).hasClass( "active" ) ) {
28				$( ".search-toggle" ).removeClass( "active" );
29				$( ".search-container" ).slideToggle();
30			}
31			return false;
32		});
33
34
35		// Toggle search container
36		$( ".search-toggle" ).on( "click", function() {
37			$( this ).toggleClass( "active" );
38			$( ".search-container" ).slideToggle();
39			if ( $( ".nav-toggle" ).hasClass( "active" ) ) {
40				$( ".nav-toggle" ).removeClass( "active" );
41				$( ".header-bottom-menu" ).slideToggle();
42			}
43			return false;
44		});
45
46		$( window ).resize( function() {
47
48			// Prevent the Android keyboard from triggering the following code
49			if ( windowWidth !== $( window ).width() ) {
50
51				// Hide mobile menu/search container at resize
52				if ( $(window).width() >= 851 ) {
53					$( ".nav-toggle" ).removeClass( "active" );
54					$( ".header-bottom-menu" ).show();
55				}
56
57				if ( $(window).width() <= 850 ) {
58					$( ".search-toggle" ).removeClass( "active" );
59					$( ".search-container" ).hide();
60				}
61
62				// Dropdown menus on touch devices, excluding mobile menu
63				if ( $(window).width() <= 851 ) {
64					$( ".header-bottom-menu li:has(ul)" ).doubleTapToGo();
65					$( ".header-top-menu li:has(ul)" ).doubleTapToGo();
66				}
67
68				if ( $(window).width() >= 850 ) {
69					$( ".header-bottom-menu li:has(ul)" ).unbind();
70					$( ".header-top-menu li:has(ul)" ).unbind();
71				}
72			}
73
74			windowWidth = $( window ).width();
75
76		}).resize();
77
78		// Load Flexslider
79		$( ".flexslider" ).flexslider( {
80			animation: "slide",
81			controlNav: false,
82			prevText: "",
83			nextText: "",
84			smoothHeight: true
85		});
86
87		// smooth scroll to the top
88		$( ".to-the-top" ).click( function() {
89			$( "html, body" ).animate( { scrollTop: 0 }, 500 );
90				return false;
91		});
92
93	});
94
95
96	/**
97	 * On load
98	 */
99	$( document.body ).on( 'post-load', function () {
100
101		// Load Flexslider after new posts have been added to the page.
102		$( ".flexslider" ).flexslider( {
103			animation: "slide",
104			controlNav: false,
105			prevText: "",
106			nextText: "",
107			smoothHeight: true
108		});
109
110	});
111
112} ) ( 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.