PageSourceSearch

https://www.shellyinreallife.com/wp-content/themes/pearl/assets/js/scripts.js?ver=1.0.0

js shellyinreallife.com collected 2026-09-26 07:51:22 UTC 2,518 bytes, 112 lines download raw bytes

1/**
2 * Pearl Scripts
3 */
4
5(function($) {
6	
7	$( document ).ready(function() {
8		
9		// Load Superfish menu.
10		$('ul.sf-menu').superfish({
11			autoArrows: false,
12		});
13				
14		$('.mobile-toggle a').click(function(event) {
15			
16			event.preventDefault();
17
18			// Mobile menu functionality.
19			var $mobileMenu = $(this).parent().next();
20			
21			if($mobileMenu.is('.is-open')){
22				$mobileMenu.slideUp(500);
23				$mobileMenu.removeClass('is-open');
24			}
25			else {
26				$mobileMenu.slideDown(500);
27				$mobileMenu.addClass('is-open');
28			}
29
30		});
31		
32		$('.mobile-menu-container .menu-item-has-children > a').click(function(event) {
33			
34			event.preventDefault();
35			
36			var $subMenu = $(this).next();
37			
38			if($subMenu.is('.is-open')){
39				$subMenu.slideUp(500);
40				$subMenu.removeClass('is-open');
41			}
42			else {
43				$subMenu.slideDown(500);
44				$subMenu.addClass('is-open');
45			}
46
47		});
48		
49		// Add class to links containing images.
50		$('.entry-content a').has('img').addClass('has-image');
51		
52		// Search popup functionality.
53		var $searchModal = $("#search-modal"),
54			$searchOverlay = $("#search-overlay"),
55			$searchOpen = $(".search-open a"),
56			$searchClose = $("#search-close a");
57
58		function openSearch() {	
59			$searchModal.fadeIn(500);
60			$searchOverlay.fadeIn(500);
61		}
62
63		function closeSearch() {	
64			$searchModal.fadeOut(500);
65			$searchOverlay.fadeOut(500);
66		}
67		
68		$searchOpen.on( 'click', function( event ) {
69			event.preventDefault();
70			openSearch();
71		});
72
73		$searchClose.on( 'click', function( event ) {
74			event.preventDefault();
75			closeSearch();
76		});
77
78		$searchOverlay.on('click', closeSearch);
79		
80		// Check screen size for mobile or desktop only scripts.
81		$(window).on('resize', function () {
82			checkScreenSize();
83		});
84
85		checkScreenSize();
86
87		function checkScreenSize() {			
88			var newWindowWidth = $(window).width();
89			
90			// Run on desktop and tablet only.
91			if (newWindowWidth > 767) {
92				
93				// Get an array of all post grid title heights
94				var elementHeights = $('.post-feed-grid .post-grid .entry-title').map(function() {
95					return $(this).height();
96				}).get();
97
98				// Math.max takes a variable number of arguments
99				// `apply` is equivalent to passing each height as an argument
100				var maxHeight = Math.max.apply(null, elementHeights);
101				
102				// Set each height to the max height
103				$('.post-feed-grid .post-grid .entry-title').height(maxHeight);
104				
105			} else {
106				$('.post-feed-grid .post-grid .entry-title').css('height', 'auto');
107			}
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.