PageSourceSearch

https://edinburghartfestival.com/wp-content/themes/abe-edinburgh-art-festival/js/navigation.js?ver=1790275020

js edinburghartfestival.com collected 2026-09-24 18:37:15 UTC 3,071 bytes, 140 lines download raw bytes

1jQuery(function ($) {
2	var $current_menu = false; // the menu currently showing
3
4	$('.primary-nav-item').on('click', function (e) {
5		e.preventDefault();
6
7		var id = $(this).data('menu-item-id');
8		var $new_menu = $('.primary-nav-menu[data-menu-item-id="' + id + '"]');
9		var $header_mask = $('#header_mask');
10		var $this = $(this);
11
12		// it might be just a link
13		if (!$this.data('menu-has-flyout')) {
14			window.location = $this.attr('href');
15			return;
16		}
17
18		// console.log(
19		//   "open menu",
20		//   $current_menu,
21		//   $new_menu,
22		//   $current_menu == $new_menu
23		// );
24
25		$header_mask.animate({
26			backgroundColor: 'rgba(255,255,255,0)',
27		});
28
29		// we might be clicking again to hide it
30		if ($current_menu && $current_menu.is($new_menu)) {
31			$current_menu.fadeOut();
32			$current_menu = false;
33
34			$header_mask.animate({
35				// backgroundColor: "rgba(255,255,255,1)",
36			});
37
38			return;
39		}
40
41		// hide all menus
42		$('.primary-nav-menu').not($new_menu).hide();
43
44		// show the menu we're hovering over
45
46		// ensure we snap to other menus rather than fading awkwardly
47		if ($current_menu) {
48			$current_menu.hide();
49			$new_menu.show();
50
51			// fade the colour nicely (I wonder if chris will hate this)
52			transitionColour($current_menu, $new_menu);
53		} else {
54			$new_menu.fadeIn(); // no menu currently showing - fade in the menu
55		}
56
57		$current_menu = $new_menu;
58	});
59
60	function transitionColour($old_menu, $new_menu) {
61		var old_colour = $old_menu.css('backgroundColor');
62		var new_colour = $new_menu.css('backgroundColor');
63
64		$new_menu.css('backgroundColor', old_colour);
65
66		$new_menu.animate({
67			backgroundColor: new_colour,
68		});
69	}
70
71	var aTop = $('header').height();
72	var logo = $('#logo-desktop');
73	var logoContainer = $('#logo-container');
74	var scrollSwitch = false;
75
76	// console.log(aTop);
77
78	var timer;
79
80	function addRedux() {
81		timer = setTimeout(function () {
82			logoContainer.addClass('redux');
83		}, 800);
84	}
85
86	// logo animation on scroll
87	$(window).on('scroll', function () {
88		if ($(this).scrollTop() >= aTop && scrollSwitch == false) {
89			// console.log('header just passed.');
90
91			if (!logo.hasClass('reduced')) {
92				logo.addClass('reduced');
93
94				addRedux();
95				// console.log('class Added');
96			}
97
98			scrollSwitch == true;
99		}
100
101		if ($(this).scrollTop() < aTop) {
102			// console.log('back at top');
103
104			if (logo.hasClass('reduced')) {
105				clearTimeout(timer);
106				logo.removeClass('reduced');
107				logoContainer.removeClass('redux');
108
109				// console.log('class Removed');
110			}
111
112			scrollSwitch == false;
113		}
114	});
115
116	// logo animation on load
117	$(window).on('load', function () {
118		if ($(this).scrollTop() >= aTop && scrollSwitch == false) {
119			// console.log('header just passed.');
120
121			if (!logo.hasClass('reduced')) {
122				logo.addClass('reduced');
123				// console.log('class Added');
124			}
125
126			scrollSwitch == true;
127		}
128
129		if ($(this).scrollTop() < aTop) {
130			// console.log('back at top');
131
132			if (logo.hasClass('reduced')) {
133				logo.removeClass('reduced');
134				// console.log('class Removed');
135			}
136
137			scrollSwitch == false;
138		}
139	});
140});

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.