PageSourceSearch

https://www.lokjun.edu.hk/wp-content/themes/theme5_style_1/js/t5.js

js lokjun.edu.hk collected 2026-10-02 22:27:27 UTC 3,220 bytes, 101 lines download raw bytes

1// JavaScript Document
2$(document).ready(function(){
3	/* Mobile menu background */
4	$(function() {
5		$('.btnClose').click(function(){
6			$(this).parent().remove();
7		})
8		var x = document.getElementById("mmBtn").getAttribute("data-toggle");
9		$('.navbar-toggle').on('click', function() {
10			if (x === 'collapse') {
11				$('body').addClass('mmOpen');
12				document.documentElement.style.overflow = 'hidden';
13				document.documentElement.style.height = '100%';
14			}
15		});
16		
17		$('nav').on('click', function() {
18			$('body').removeClass("mmOpen");
19			document.documentElement.style.overflow = 'auto';
20			document.documentElement.style.height = 'auto';
21		});
22		$('body').click (function() {
23			var y = document.getElementById("mmBtn").getAttribute("aria-expanded");
24			if (y === 'true') {
25				$('body').removeClass('mmOpen');
26				document.getElementById('navbar').setAttribute('aria-expanded', 'false');
27				document.documentElement.style.overflow = 'visible';
28				document.documentElement.style.height = 'auto';
29				$('#mmBtn').addClass('collapsed');
30				$('#mmBtn').attr('aria-expanded', 'false');
31			}
32		});
33		
34		$('#navbar').click (function() {
35			var y = document.getElementById('mmBtn').getAttribute('aria-expanded');
36			if (y === 'true') {
37				$('body').removeClass('mmOpen');
38				$('#navbar').removeClass('in');
39				document.getElementById('navbar').setAttribute('aria-expanded', 'false');
40				document.documentElement.style.overflow = 'visible';
41				document.documentElement.style.height = 'auto';
42				$('#mmBtn').addClass('collapsed');
43				$('#mmBtn').attr('aria-expanded', 'false');
44			}
45		});
46	});
47	
48	$("#navbar > ul > .dropdown").on('mouseenter mouseleave', function (e) {
49		if ($('ul', this).length) {
50			var menuItem = $('ul:first', this);
51			var checkOff = menuItem.offset().left;
52			var checkOff_width = menuItem.width();
53			var con = $("#mainMenu");
54			var con_off = con.offset().left;
55			var con_width = con.width();
56
57			var isEntirelyVisible = (checkOff + checkOff_width <= con_off + con_width);
58
59			if (!isEntirelyVisible) {
60				$(this).addClass('showRight');
61			}
62		}
63	});
64
65	$("#navbar > ul > .dropdown > ul > li").on('mouseenter mouseleave', function (e) {
66		if ($('ul', this).length) {
67			var menuItem = $('ul:first', this);
68			var checkOff = menuItem.offset().left;
69			var checkOff_width = menuItem.width();
70			var con = $("#mainMenu");
71			var con_off = con.offset().left;
72			var con_width = con.width();
73
74			var isEntirelyVisible = (checkOff + checkOff_width <= con_off + con_width);
75
76			if (!isEntirelyVisible) {
77				$(this).addClass('showRight');
78			} else {
79				$(this).removeClass('showRight');
80			}
81		}
82	});
83});
84
85function setMenu() {
86	var schLogoHeight = document.getElementById("schLogo").offsetHeight;
87	var mainMenuHeight = document.getElementById("mainMenu").offsetHeight;
88	var menuHeight = window.innerHeight - schLogoHeight;
89	var mainMenu = document.getElementById('mainMenu');
90	
91	/* Function set header height */
92	if (window.innerWidth < 992){
93		mainMenu.style.top = schLogoHeight -1 + 'px';
94		mainMenu.style.height = menuHeight + 'px';
95
96	}
97}
98
99window.onload = function() {
100	setMenu();
101};

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.