PageSourceSearch

https://hopeafrica.com/wp-content/themes/hopeafrica/js/jquery.site.js?ver=1.0

js hopeafrica.com collected 2026-10-08 06:31:09 UTC 12,431 bytes, 405 lines download raw bytes

1var offsetTop, clicked, active, id, activeId, tileImage, activeTileImage, activeLink, parentContainer, title, animatedIterator=0, testimonialSwiper;
2
3$(document).ready(function(){
4	//Attach FastClick to eliminate delays for taps on mobile devices.
5	FastClick.attach(document.body);	
6	
7	//Hide any transitions from appearing before the page completely loads. 
8	$(window).load(function() {
9	  $("body").removeAttr('id');
10	});
11
12	animatedIterator = 0;
13	
14	//Add animation to introduction text...
15	$('#hero-content, .introduction-container >div').children().each(function(){
16		$(this).addClass('animated fadeInUpShort');
17		$(this).attr('data-id', animatedIterator);
18		animatedIterator++;
19	});
20	
21	//Page transition animation...
22	$(".animsition").animsition({
23		inClass: 'fade-in',
24		outClass: 'fade-out',
25		inDuration: 1400,
26		outDuration: 1000,
27		linkElement: '.animsition-link',
28		// e.g. linkElement: 'a:not([target="_blank"]):not([href^="#"])'
29		loading: true,
30		loadingParentElement: 'html', //animsition wrapper element
31		loadingClass: 'animsition-loading',
32		loadingInner: '<img src="' + window.location.protocol + "//" + window.location.host + '/wp-content/themes/hopeafrica/images/loading.svg" />', // e.g '<img src="loading.svg" />'
33		timeout: false,
34		timeoutCountdown: 5000,
35		onLoadEvent: true,
36		browser: [ 'animation-duration', '-webkit-animation-duration'],
37		overlay : false,
38		overlayClass : 'animsition-overlay-slide',
39		overlayParentElement : 'body',
40		transition: function(url){ window.location.href = url; }
41	});	
42	
43	//Style the dropdowns...
44	$('select:not(#mobile-page-dropdown):not(#mobile-category-dropdown)').fancySelect();
45	
46	$('#mobile-page-dropdown').fancySelect().on('change.fs', function(){
47		window.location.href = this.value;
48	});
49
50	$('#mobile-category-dropdown').fancySelect().on('change.fs', function(){
51		window.location.href = window.location.protocol + "//" + window.location.host + '/?cat=' + this.value;
52	});
53	
54    //Toggle the mobile menu...
55    $('#mobile-menu-icon').on('click', function(e) {
56	    e.preventDefault();
57	    
58        $(this).toggleClass('active');
59
60        $('#mobile-menu').toggleClass('is-visible');
61        setTimeout(function() {
62            $('body').toggleClass('nav-menu-open');
63        }, 400);
64    });		
65
66	//Make YouTube/Vimeo iframes responsive...
67   	$('iframe[src*="vimeo"], iframe[src*="youtube"]').parent().fitVids();   
68   			
69    //Remove an error class on click...
70    $(document).on('click', '.fancy-select .trigger', function(){
71	    $(this).closest('li').removeClass('gfield_error'); 
72    });    	
73    
74    //Remove an error class on keyup...
75    $(document).on('keyup', '.gform_body input[type="text"], .gform_body textarea', function(){
76		$(this).closest('li').removeClass('gfield_error'); 
77    });
78    
79	//Fancify the dropdowns on post GForm render...
80	$(document).bind('gform_post_render', function(){    
81        $('form select:not(.fancified)').fancySelect();
82    });	     
83    
84    //Display/hide the stickey header on the home page...
85	if($('#sticky-header-container').length)
86	{
87		offsetTop = $('#introduction-container').offset().top;
88		
89		if($(window).scrollTop() > offsetTop)
90		{
91			$('#sticky-header-container').addClass('show');
92			
93			if($(window).width() > 1040)
94			{
95				$('#hero-container').addClass('hide-hero');
96			}
97		}
98	}     
99    
100    $(window).on('scroll', function(){
101		if($('#sticky-header-container').length)
102		{
103			offsetTop = $('#introduction-container').offset().top;
104			
105			if($(window).scrollTop() > offsetTop)
106			{
107				$('#sticky-header-container').addClass('show');
108				
109				if($(window).width() > 1040)
110				{
111					$('#hero-container').addClass('hide-hero');
112				}
113			}
114			else
115			{
116				$('#sticky-header-container').removeClass('show');
117				
118				if($(window).width() > 1040)
119				{
120					$('#hero-container').removeClass('hide-hero');
121				}
122			}
123		}    
124    }); 
125    
126    $('.mark-link').on('click', function(e){
127	    e.preventDefault();
128    
129		window.location.href = $(this).attr('data-href');
130    });
131	
132	//Home page What We Do Tiles...
133	$('#what-we-do-tiles .what-we-do-tile').on('mouseover', function(e){
134		e.preventDefault();
135		
136		clicked = $(this);
137		
138		if(!$(clicked).hasClass('active'))
139		{
140			active = $('#what-we-do-tiles .what-we-do-tile.active');
141			activeId = $(active).attr('data-id');
142			activeTileImage = $('#what-we-do-images > div.active');
143			
144			if($(active).length)
145			{
146				$(active).find('.what-we-do-tile-hover').removeClass('show-tile');
147				$(active).removeClass('active');
148				
149				$(clicked).find('.what-we-do-tile-hover').addClass('show-tile');
150				$(clicked).addClass('active');	
151				id = $(clicked).attr('data-id');
152				tileImage = $('#what-we-do-images >div[data-id="' + id + '"]');
153				
154				$(activeTileImage).fadeOut(500, function(){
155					$(activeTileImage).removeClass('active');
156				});
157				$(tileImage).fadeIn(500, function(){
158					$(tileImage).addClass('active');
159				});								
160			}
161		}
162	});
163	
164	//Personnel Grouping Toggle...
165	$('#personnel-group-header a').on('click', function(e){
166		e.preventDefault();
167		
168		if(!$(this).hasClass('active'))
169		{
170			clicked = $(this);
171			activeLink = $('#personnel-group-header a.active');
172			id = $(clicked).attr('data-id');
173			
174			$('.personnel-group.active').slideUp(500, function(){
175				$(this).removeClass('active');	
176				$(activeLink).removeClass('active');
177				
178				$(clicked).addClass('active');
179				$('.personnel-group[data-id="' + id + '"]').slideDown(500, function(){
180					$(this).addClass('active');
181				});
182			});
183		}
184	});
185	
186	//Personnel Biography Toggle...
187	$('.personnel-toggle').on('click', function(e){
188		e.preventDefault();
189	
190		clicked = $(this);
191		active = $('.personnel-group.active .personnel.active');
192		
193		if($(this).parent().hasClass('active'))
194		{
195			$(clicked).parent().removeClass('active');
196			$(clicked).next('.personnel-biography').slideUp(500);				
197		}
198		else
199		{
200			if($(active).length)
201			{
202				$(active).removeClass('active');
203				$(active).find('.personnel-biography').slideUp(500, function(){
204					$(clicked).parent().addClass('active');
205					$(clicked).next('.personnel-biography').slideDown(500);	
206				});
207			}
208			else
209			{
210				$(clicked).parent().addClass('active');
211				$(clicked).next('.personnel-biography').slideDown(500);	
212			}
213		}
214	});
215	
216    //Handle the clicking of a share button...
217    $('#share-link').on('click', function(e){
218		e.preventDefault();
219		
220		$('body').addClass('overlay-open');
221        $("#share-wrapper").fadeIn();
222        setTimeout(function () {
223            $("#share-content").fadeIn();
224        }, 500); 		 
225    });
226    
227	//Hide the clicking of the close share button...
228    $(document).on('click', '#close-share', function (e) {
229	    e.preventDefault();
230	    
231        $("#share-content").fadeOut();
232        $('body').removeClass('overlay-open');
233        setTimeout(function () {
234            $("#share-wrapper").fadeOut(100);
235        }, 500);
236    });	
237 
238    //Toggle the Job details...
239    $('.toggle-job:not(.mobile)').on('click', function(e){
240		e.preventDefault();
241		
242		clicked = $(this);
243		
244		if($(clicked).parent().parent().parent().hasClass('active'))
245		{
246			$(clicked).parent().parent().parent().find('.job-content').slideUp(500);
247			$(clicked).parent().parent().parent().removeClass('active');	
248		} 
249		else
250		{
251			if($('.job.active').length)
252			{
253				$('.job.active').parent().parent().parent().find('.job-content').slideUp(500, function(){
254					$('.job.active').parent().parent().parent().removeClass('active');
255					
256					$(clicked).parent().parent().parent().find('.job-content').slideDown(500);
257					$(clicked).parent().parent().parent().addClass('active');
258				});
259			}
260			else
261			{
262				$(clicked).parent().parent().parent().find('.job-content').slideDown(500);
263				$(clicked).parent().parent().parent().addClass('active');
264			}
265		}
266    });
267    
268    $('.title-toggle-job, .toggle-job.mobile').on('click', function(e){
269		e.preventDefault();
270		
271		clicked = $(this);
272		
273		if($(clicked).parent().parent().parent().parent().hasClass('active'))
274		{
275			$(clicked).parent().parent().parent().parent().find('.job-content').slideUp(500);
276			$(clicked).parent().parent().parent().parent().removeClass('active');	
277		} 
278		else
279		{
280			if($('.job.active').length)
281			{
282				$('.job.active').parent().parent().parent().find('.job-content').slideUp(500, function(){
283					$('.job.active').parent().parent().parent().removeClass('active');
284					
285					$(clicked).parent().parent().parent().parent().find('.job-content').slideDown(500);
286					$(clicked).parent().parent().parent().parent().addClass('active');
287				});
288			}
289			else
290			{
291				$(clicked).parent().parent().parent().parent().find('.job-content').slideDown(500);
292				$(clicked).parent().parent().parent().parent().addClass('active');
293			}
294		}
295    });
296    
297    $('.title-toggle-accordion, .toggle-accordion').on('click', function(e){
298		e.preventDefault();
299		
300		clicked = $(this);
301		
302		if($(clicked).parent().parent().parent().hasClass('active'))
303		{
304			$(clicked).parent().parent().parent().find('.accordion-content').slideUp(500);
305			$(clicked).parent().parent().parent().removeClass('active');	
306		} 
307		else
308		{
309			if($('.accordion.active').length)
310			{
311				$('.accordion.active').parent().parent().find('.accordion-content').slideUp(500, function(){
312					$('.accordion.active').parent().parent().removeClass('active');
313					
314					$(clicked).parent().parent().parent().find('.accordion-content').slideDown(500);
315					$(clicked).parent().parent().parent().addClass('active');
316				});
317			}
318			else
319			{
320				$(clicked).parent().parent().parent().find('.accordion-content').slideDown(500);
321				$(clicked).parent().parent().parent().addClass('active');
322			}
323		}
324    });	    	    	
325    
326    //Toggle the give country information...
327    $('.give-toggle').on('click', function(e){
328		e.preventDefault();
329		
330		clicked = $(this);
331		id = $(this).attr('data-country');
332		title = $(this).find('h4').text();
333		 
334		$('#selection-overlay').slideUp(500);
335		$('.country-give-content[data-id="' + id + '"]').slideDown(500, function(){
336			$(this).addClass('active');
337			$('#interior-header-container > div > div').empty();
338			$('#interior-header-container > div > div').html('<h1>' + title + '</h1');	
339			//In order to handle oddness with Safari header text swap...
340			window.resizeTo($(window).width ()- 1, $(window).height());
341			
342			$('html, body').animate({
343			    scrollTop: $('.country-give-content[data-id="' + id + '"]').offset().top - 100 //#DIV_ID is an example. Use the id of your destination on the page
344			}, 'slow');
345			
346			if(history.pushState)
347			{
348				var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?country=' + id;
349				window.history.pushState({path:newurl},'',newurl);
350			}				
351		});
352    });
353    
354    //Toggle the FAQs...
355    $('.title-toggle-faq, .toggle-faq').on('click', function(e){
356		e.preventDefault();
357		
358		clicked = $(this);
359		parentContainer = $('.country-give-content.active');
360		
361		if($(clicked).parent().parent().parent().hasClass('active'))
362		{
363			$(clicked).parent().parent().parent().find('.faq-content').slideUp(500);
364			$(clicked).parent().parent().parent().removeClass('active');	
365		} 
366		else
367		{
368			if($(parentContainer).find('.faq.active').length)
369			{
370				$(parentContainer).find('.faq.active').find('.faq-content').slideUp(500, function(){
371					$(clicked).parent().parent().parent().find('.faq-content').slideDown(500, function(){
372						$(parentContainer).find('.faq.active').removeClass('active');
373						console.log('remove');
374					
375						$(clicked).parent().parent().parent().addClass('active');	
376					});
377				});
378			}
379			else
380			{
381				$(clicked).parent().parent().parent().find('.faq-content').slideDown(500);
382				$(clicked).parent().parent().parent().addClass('active');
383			}
384		}
385    });  
386    
387    testimonialSwiper = new Swiper('#single-partner-testimonial .swiper-container', {
388	    pagination: $('#single-partner-testimonial .swiper-container .swiper-slide').length > 1 ? '.swiper-pagination' : false,
389	    paginationClickable: true,
390	    autoplay: $('#single-partner-testimonial .swiper-container .swiper-slide').length > 1 ? 4000 : false,
391	    loop: true,
392	    speed: 600
393	});  
394	    
395    //Window resize functions...
396    $(window).on('resize', function() {
397	    if($(window).width() > 1040)
398	    {
399    		$('#mobile-menu-icon').removeClass('active');
400
401			$('#mobile-menu').removeClass('is-visible');
402			$('body').removeClass('nav-menu-open');
403		}
404	});    
405});

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.