PageSourceSearch

https://www.fch.org.bb/cdn/assets/libraries/menu/js/menu_01.js?1790298379

js fch.org.bb collected 2026-09-25 01:07:05 UTC 5,307 bytes, 157 lines download raw bytes

1/* Menu Open Function S */
2    function openNav() {
3        document.getElementById("menu").style.left = "0";
4        document.getElementById("menu__open").style.display = "none";
5        document.getElementById("menu__close").style.display = "inline-block";
6        $("body").addClass('menu_overlap');
7    }
8/* Menu Open Function E */
9
10/* Menu Close Function S */
11    function closeNav() {
12        document.getElementById("menu").style.left = "-320px";
13        document.getElementById("menu__open").style.display = "inline-block";
14        document.getElementById("menu__close").style.display = "none";
15        $("body").removeClass('menu_overlap');
16        $(".menu .is-open").removeClass("is-close");
17    }
18/* Menu Close Function E */
19
20$( document ).ready(function() {
21    var $button = $('#accordionMenu').clone();
22    $('#full-menu-clone').html($button);
23});
24
25/* Responsive Class Add S */
26    $( document ).ready(function() {
27        $(".menu ul li").find("ul").before('<span class="is-open"></span>');
28        $(".menu ul li").find("ul").parent("li").addClass("is-open-a");
29        $(".menu .is-open").click(function(event) {
30            event.preventDefault();
31            $(this).toggleClass("is-close");
32        });
33    });
34/* Responsive Class Add E */
35
36/* Tab Menu Height Calc S */
37    $("#menu > ul > li > a").hover(function(){
38        var liMaxHeight = -1;
39        $(".tab-menu li ul").each(function(index) {
40            if ($(this).outerHeight() > liMaxHeight) {
41                liMaxHeight = $(this).outerHeight();
42            }
43        });
44        $(".tab-menu").css("min-height", liMaxHeight);
45        $(".tab-menu > li > ul").css("min-height", liMaxHeight);
46        //console.log($(".tab-menu > li > ul").css("min-height", liMaxHeight));
47    });
48/* Tab Menu Height Calc E */
49
50/* Hide Header on on scroll down S */
51    var didScroll;
52    var lastScrollTop = 0;
53    var delta = 5;
54    var navbarHeight = $('header').outerHeight();
55
56    $(window).scroll(function(event){
57        didScroll = true;
58    });
59
60    setInterval(function() {
61        if (didScroll) {
62            hasScrolled();
63            didScroll = false;
64        }
65    }, 250);
66
67    function hasScrolled() {
68        var st = $(this).scrollTop();
69        if(Math.abs(lastScrollTop - st) <= delta)
70            return;
71        if (st > lastScrollTop && st > navbarHeight){
72            $('header').removeClass('nav-down').addClass('nav-up');
73        } else {
74            if(st + $(window).height() < $(document).height()) {
75                $('header').removeClass('nav-up').addClass('nav-down');
76            }
77        }    
78        lastScrollTop = st;
79    }
80    $(window).scroll(function() {
81        var scroll = $(window).scrollTop();
82        if (scroll >= 50) {
83            $("header").addClass("mobile-stick");
84        } else{
85            $("header").removeClass("mobile-stick");
86        }
87    });
88/* Hide Header on on scroll down E */
89
90/* Center Logo JS S */
91    function brandCenter() {
92        var getNav = $("nav.menu");
93        if (getNav.hasClass("brand-center")) {
94            var postsArr = new Array(),
95                index = $("nav.brand-center"),
96                $postsList = index.find('ul.brand-navbar');
97
98            //Create array of all posts in lists
99            index.find('ul.brand-navbar > li').each(function() {
100                postsArr.push($(this).html());
101            });
102
103            //Split the array at this point. The original array is altered.
104            var firstList = postsArr.splice(0, Math.round(postsArr.length / 2)),
105                secondList = postsArr,
106                ListHTML = '';
107
108            var createHTML = function(list) {
109                ListHTML = '';
110                for (var i = 0; i < list.length; i++) {
111                    ListHTML += '<li>' + list[i] + '</li>';
112                }
113            }
114
115            //Generate HTML for first list
116            createHTML(firstList);
117            $postsList.html(ListHTML);
118            index.find("ul.brand-nav").first().addClass("navbar-left");
119
120            //Generate HTML for second list
121            createHTML(secondList);
122            $postsList.after('<ul class="brand-nav brand-navbar"></ul>').next().html(ListHTML);
123            index.find("ul.brand-nav").last().addClass("navbar-right");
124
125            //Wrap navigation menu
126            index.find("ul.brand-nav.navbar-left").wrap("<div class='col_half left'></div>");
127            index.find("ul.brand-nav.navbar-right").wrap("<div class='col_half right'></div>");
128        }
129    }
130    brandCenter ();
131/* Center Logo JS E */
132
133
134
135$('#menu-toggle').on('click', function(){    
136    $('body').addClass('open');
137    $('#back-top').hide();
138});
139$('#menu-close').on('click', function(){
140    $('body').removeClass('open');
141});
142
143
144// mobile menu li click open dropdown
145$(document).ready(function(){
146    $(".mobile-wrap ul li a").click(function(){
147        $(this).siblings('.is-open').toggleClass('is-close');
148    });
149});
150
151$(window).resize(function(){
152	if (window.matchMedia('(max-width: 1199px)').matches){	
153		$(".mobile-wrap ul li a").click(function(){
154            $(this).siblings('.is-open').toggleClass('is-close');
155        });
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.