PageSourceSearch

https://www.anzliterature.com/wp-content/themes/academy-of-new-zealand-literature/js/functions.js?ver=1.0

js anzliterature.com collected 2026-10-02 10:54:38 UTC 4,518 bytes, 157 lines download raw bytes

1jQuery(document).ready(function($) {
2
3	//flexslider
4	$('.flexslider').flexslider({
5	    animation: "slide"
6	  });
7
8	//function for showing/hiding mobile menu button dynamically
9	function mobileMenuToggle(){
10		//get height of menu and auto-detect when it needs to switch to mobile version
11		var menuHeight = $('#site-navigation').height();
12
13		//menu pushed onto 2 lines, hide it and show mobile one
14		if((isMobile == false) && (menuHeight > 50)){
15			//get the current browser width, as once the browser is this width (or wider) again, normal menu will need to kick in.
16			$('#site-navigation').hide();
17			$('#mobile-toggle').show();
18			$('#masthead').addClass('mobile');
19
20			isMobile = true;
21			browserWidth = $('body').width();
22
23		}
24		if(isMobile == true){
25			
26			//if browser reaches the fixed size recorded, switch back to normal menu again
27			if($('body').width() > browserWidth){
28				$('#site-navigation').show();
29				$('#mobile-toggle').hide();
30				$('#masthead').removeClass('mobile');
31				isMobile = false;
32
33			}
34		}
35	}
36	var isMobile = false;//start as false, then check:
37	mobileMenuToggle();
38
39	function removeEqualHeight(){
40		screenWidth = $('body').width();
41		if(screenWidth < 481) {
42			$('.equal').removeClass('equal');
43		}
44	}
45
46	// Match heights of elements on homepage for uniform display
47	matchHeight = function() {
48		//Timeout added to counteract delays in element sizing from loading
49		setTimeout(function(){
50			jQuery('.equal').each(function(){
51				var maxHeight = '0';
52				jQuery('.equal').each(function(){
53					maxHeight = (jQuery(this).height() > maxHeight) ? jQuery(this).height() : maxHeight;
54				});
55				jQuery('.equal').height(maxHeight);
56			});
57
58			jQuery('.equal2').each(function(){
59				var maxHeight = '0';
60				jQuery('.equal2').each(function(){
61					maxHeight = (jQuery(this).height() > maxHeight) ? jQuery(this).height() : maxHeight;
62				});
63				jQuery('.equal2').height(maxHeight);
64			});
65	 
66	 
67		}, 500);
68	}
69	 
70	jQuery(function (){
71		removeEqualHeight();
72		matchHeight();
73	});
74
75	//window resize (device rotated)
76	$(window).resize(function() {
77		mobileMenuToggle();
78		removeEqualHeight();
79		matchHeight();
80	});
81
82	//slide-push menu
83	var menuLeft = document.getElementById( 'cbp-spmenu-s1' ),
84		menuRight = document.getElementById( 'cbp-spmenu-s2' ),
85		menuTop = document.getElementById( 'cbp-spmenu-s3' ),
86		menuBottom = document.getElementById( 'cbp-spmenu-s4' ),
87		showLeft = document.getElementById( 'showLeft' ),
88		showRight = document.getElementById( 'showRight' ),
89		showTop = document.getElementById( 'showTop' ),
90		showBottom = document.getElementById( 'showBottom' ),
91		showLeftPush = document.getElementById( 'showLeftPush' ),
92		showRightPush = document.getElementById( 'showRightPush' ),
93		body = document.body;
94
95	showLeft.onclick = function() {
96		classie.toggle( this, 'active' );
97		classie.toggle( menuLeft, 'cbp-spmenu-open' );
98		disableOther( 'showLeft' );
99	};
100
101	function disableOther( button ) {
102		if( button !== 'showLeft' ) {
103			classie.toggle( showLeft, 'disabled' );
104		}
105		if( button !== 'showRight' ) {
106			classie.toggle( showRight, 'disabled' );
107		}
108		if( button !== 'showTop' ) {
109			classie.toggle( showTop, 'disabled' );
110		}
111		if( button !== 'showBottom' ) {
112			classie.toggle( showBottom, 'disabled' );
113		}
114		if( button !== 'showLeftPush' ) {
115			classie.toggle( showLeftPush, 'disabled' );
116		}
117		if( button !== 'showRightPush' ) {
118			classie.toggle( showRightPush, 'disabled' );
119		}
120	}
121
122	//hide menu on click of close button
123	$('#menuClose').click(function(){
124		$('.cbp-spmenu-left').removeClass('cbp-spmenu-open');
125	});
126
127	//show/hide search bar
128	$('#search-icon').click(function(){
129		$('#search-bar').toggleClass('expand');
130	});
131
132	//member/fellow tabs
133	$('#fellow-member .responsivetabs').responsiveTabs({
134	    startCollapsed: false,
135	    active: 0
136	});
137
138	//get height of both member tabs and set them to be the height of the tallest one, once images loaded
139	$('img').load(function() {
140		setTimeout(function(){
141		var memberTab1Height = $('#tab-1').height();
142		var memberTab2Height = $('#tab-2').height();
143		var maxMemberTabHeight = Math.max(memberTab1Height,memberTab2Height);//get biggest height
144		$('#tab-1').height(maxMemberTabHeight);//set heights
145		$('#tab-2').height(maxMemberTabHeight);
146		}, 500);
147	});
148
149	//add active class to member surname initial on click
150	var letter = $('body').attr('id');
151	if(letter){
152		letter = letter.substring(0, 1);
153	}
154	$('#wpv_heading_tab li').removeClass('active');
155	$('li[data-letter="' + letter + '"]').addClass('active');
156
157});

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.